Skip to content

Refactor#1

Open
Jarrod-Fivium wants to merge 3 commits intomasterfrom
develop
Open

Refactor#1
Jarrod-Fivium wants to merge 3 commits intomasterfrom
develop

Conversation

@Jarrod-Fivium
Copy link
Copy Markdown
Contributor

No description provided.

Comment thread projects/admin.py
pass


@admin.register(SuiteDetail)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh I didn't know you could add a decorator to do an admin.register...

neat!

Comment thread projects/static/projects/css/style.css Outdated
height: 100%;
width: 100%;
position: absolute; }
background-color: #FEFEFE !important; }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

covFEFE

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#COVFEFE is a different color
image

Comment thread projects/static/projects/css/style.css Outdated
@@ -46,24 +46,16 @@ html {
font-family: "Trebuchet MS", sans-serif; }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The closing curly brace should be on the next line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is autogenerated via sass

Comment thread projects/templates/projects/base.html Outdated
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'projects/css/style.css' %}">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh ... good use of html5 integrity / crossorigin attributes!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sarcasm? I copypasta'd

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Come on at least take credit for it! Do you understand what they do? Here's a good explanation. Essentially it's like a simple way of defining CORS (cross-origin resource sharing) as well as verifying that nothing is tampering with your CDN code.

<th class="left-align">Result</th>
<th class="right-align">Actions</th>
</tr>
{% for btd in tests %}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try and be more verbose in variable names. I have no idea what btd is!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of these have been renamed

<th class="left-align">Description</th>
<th class="right-align">Actions</th>
</tr>
{% for bid in builds %}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, bid isn't overly helpful. try to use the singular. something like the following is the pythonic way:

for instance in instances:
  instance.do_your_thing()

<th class="left-align">Required?</th>
<th class="right-align">Actions</th>
</tr>
{% for td in tests %}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like td could be confused for table data. again, probably best with test for this one.

Comment thread projects/views.py
@@ -0,0 +1,306 @@
from django.views.generic import ListView, DetailView, CreateView, UpdateView, DeleteView
from .models import *
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, avoid import *

Comment thread projects/views.py
from .models import *
from django.http import HttpResponseRedirect
from datetime import datetime
import reversion
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order of imports should be (according to PEP8):

standard library imports
related third party imports
local application/library specific imports

You should put a blank line between each group of imports.

Comment thread projects/views.py
# Create your views here.
class IndexView(ListView):
template_name = 'projects/index.html'
context_object_name = 'projects'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, this should reference a global specified in settings.

Comment thread projects/views.py Outdated
# DETAILS
class ProjectDetailView(DetailView):
model = ProjectDetail
context_object_name = 'pd'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's wrong with just project rather than pd? Try and be descriptive in variable names.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually come to think of it - why have you got Detail after every model?

Comment thread projects/views.py Outdated
detail.save()
# Create a test suite for the bundle
with reversion.create_revision():
suite = SuiteDetail(bundle=detail, name=detail.name + ' Testing Suite', description='Test suite for ' + detail.name)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than adding together strings use the format syntax:

tom = 'tom'
new_string = '{} is a cool dude'.format(tom)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I wasn't thinking in python

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're in Python 3.6 you can do f'{tom} is a cool dude'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's kinda like the es6 backtick stuff in javascript then. neat

Sorry for the big commit
Added the reporting page with chart.js. Some css changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants