Python styling fixes

This commit is contained in:
Oliver Walters 2019-07-10 13:38:14 +10:00
parent c5e17070fb
commit d6750652f0
3 changed files with 9 additions and 16 deletions

View File

@ -35,6 +35,7 @@
{ {
field: 'part_detail', field: 'part_detail',
title: 'Part', title: 'Part',
sortable: true,
formatter: function(value, row, index, field) { formatter: function(value, row, index, field) {
var html = imageHoverIcon(row.part_detail.image_url) + renderLink(value.full_name, value.url + 'bom/'); var html = imageHoverIcon(row.part_detail.image_url) + renderLink(value.full_name, value.url + 'bom/');
@ -48,8 +49,10 @@
{ {
field: 'part_detail.description', field: 'part_detail.description',
title: 'Description', title: 'Description',
sortable: true,
}, },
{ {
sortable: true,
field: 'quantity', field: 'quantity',
title: 'Uses', title: 'Uses',
} }

View File

@ -24,9 +24,9 @@
<table class='table table-striped table-condensed' id='variant-table' data-toolbar='#button-toolbar'> <table class='table table-striped table-condensed' id='variant-table' data-toolbar='#button-toolbar'>
<thead> <thead>
<tr> <tr>
<th>Variant</th> <th data-sortable='true'>Variant</th>
<th>Description</th> <th data-sortable='true'>Description</th>
<th>Stock</th> <th data-sortable='true'>Stock</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -11,7 +11,6 @@ from django.shortcuts import HttpResponseRedirect
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.urls import reverse, reverse_lazy from django.urls import reverse, reverse_lazy
from django.views.generic import DetailView, ListView, FormView from django.views.generic import DetailView, ListView, FormView
from django.views.generic.edit import FormMixin
from django.forms.models import model_to_dict from django.forms.models import model_to_dict
from django.forms import HiddenInput, CheckboxInput from django.forms import HiddenInput, CheckboxInput
@ -655,7 +654,7 @@ class BomUpload(FormView):
During these steps, data are passed between the server/client as JSON objects. During these steps, data are passed between the server/client as JSON objects.
""" """
template_name='part/bom_upload/upload_file.html' template_name = 'part/bom_upload/upload_file.html'
# Context data passed to the forms (initially empty, extracted from uploaded file) # Context data passed to the forms (initially empty, extracted from uploaded file)
bom_headers = [] bom_headers = []
@ -664,7 +663,6 @@ class BomUpload(FormView):
missing_columns = [] missing_columns = []
allowed_parts = [] allowed_parts = []
def get_success_url(self): def get_success_url(self):
part = self.get_object() part = self.get_object()
return reverse('upload-bom', kwargs={'pk': part.id}) return reverse('upload-bom', kwargs={'pk': part.id})
@ -785,9 +783,8 @@ class BomUpload(FormView):
return self.render_to_response(self.get_context_data(form=form)) return self.render_to_response(self.get_context_data(form=form))
def getColumnIndex(self, name): def getColumnIndex(self, name):
""" Return the index of the column with the given name. """ Return the index of the column with the given name.
It named column is not found, return -1 It named column is not found, return -1
""" """
@ -798,7 +795,6 @@ class BomUpload(FormView):
return idx return idx
def preFillSelections(self): def preFillSelections(self):
""" Once data columns have been selected, attempt to pre-select the proper data from the database. """ Once data columns have been selected, attempt to pre-select the proper data from the database.
This function is called once the field selection has been validated. This function is called once the field selection has been validated.
@ -851,8 +847,6 @@ class BomUpload(FormView):
row['quantity'] = quantity row['quantity'] = quantity
row['part_options'] = [m['part'] for m in matches] row['part_options'] = [m['part'] for m in matches]
def extractDataFromFile(self, bom): def extractDataFromFile(self, bom):
""" Read data from the BOM file """ """ Read data from the BOM file """
@ -935,9 +929,6 @@ class BomUpload(FormView):
for col_idx in sorted(row.keys()): for col_idx in sorted(row.keys()):
#if col_idx not in self.column_selections.keys():
# continue
value = row[col_idx] value = row[col_idx]
items.append(value) items.append(value)
@ -980,7 +971,6 @@ class BomUpload(FormView):
if col not in self.column_selections.values(): if col not in self.column_selections.values():
self.missing_columns.append(col) self.missing_columns.append(col)
def handleFieldSelection(self): def handleFieldSelection(self):
""" Handle the output of the field selection form. """ Handle the output of the field selection form.
Here the user is presented with the raw data and must select the Here the user is presented with the raw data and must select the
@ -998,7 +988,7 @@ class BomUpload(FormView):
# Try to extract meaningful data # Try to extract meaningful data
self.preFillSelections() self.preFillSelections()
form = None form = None
self.template_name = 'part/bom_upload/select_parts.html' self.template_name = 'part/bom_upload/select_parts.html'
else: else:
self.template_name = 'part/bom_upload/select_fields.html' self.template_name = 'part/bom_upload/select_fields.html'