From d6750652f059ed0e5960251bda424eefb458b2bd Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Wed, 10 Jul 2019 13:38:14 +1000 Subject: [PATCH] Python styling fixes --- InvenTree/part/templates/part/used_in.html | 3 +++ InvenTree/part/templates/part/variants.html | 6 +++--- InvenTree/part/views.py | 16 +++------------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/InvenTree/part/templates/part/used_in.html b/InvenTree/part/templates/part/used_in.html index 06d7b39f6e..665d7ed58f 100644 --- a/InvenTree/part/templates/part/used_in.html +++ b/InvenTree/part/templates/part/used_in.html @@ -35,6 +35,7 @@ { field: 'part_detail', title: 'Part', + sortable: true, formatter: function(value, row, index, field) { var html = imageHoverIcon(row.part_detail.image_url) + renderLink(value.full_name, value.url + 'bom/'); @@ -48,8 +49,10 @@ { field: 'part_detail.description', title: 'Description', + sortable: true, }, { + sortable: true, field: 'quantity', title: 'Uses', } diff --git a/InvenTree/part/templates/part/variants.html b/InvenTree/part/templates/part/variants.html index 3ff3039b75..fd55029ba5 100644 --- a/InvenTree/part/templates/part/variants.html +++ b/InvenTree/part/templates/part/variants.html @@ -24,9 +24,9 @@ - - - + + + diff --git a/InvenTree/part/views.py b/InvenTree/part/views.py index 8cd10fac54..fae82bfc72 100644 --- a/InvenTree/part/views.py +++ b/InvenTree/part/views.py @@ -11,7 +11,6 @@ from django.shortcuts import HttpResponseRedirect from django.utils.translation import gettext_lazy as _ from django.urls import reverse, reverse_lazy 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 import HiddenInput, CheckboxInput @@ -655,7 +654,7 @@ class BomUpload(FormView): 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) bom_headers = [] @@ -664,7 +663,6 @@ class BomUpload(FormView): missing_columns = [] allowed_parts = [] - def get_success_url(self): part = self.get_object() 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)) - 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 """ @@ -798,7 +795,6 @@ class BomUpload(FormView): return idx - def preFillSelections(self): """ 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. @@ -851,8 +847,6 @@ class BomUpload(FormView): row['quantity'] = quantity row['part_options'] = [m['part'] for m in matches] - - def extractDataFromFile(self, bom): """ Read data from the BOM file """ @@ -935,9 +929,6 @@ class BomUpload(FormView): for col_idx in sorted(row.keys()): - #if col_idx not in self.column_selections.keys(): - # continue - value = row[col_idx] items.append(value) @@ -980,7 +971,6 @@ class BomUpload(FormView): if col not in self.column_selections.values(): self.missing_columns.append(col) - def handleFieldSelection(self): """ Handle the output of the field selection form. 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 self.preFillSelections() form = None - self.template_name = 'part/bom_upload/select_parts.html' + self.template_name = 'part/bom_upload/select_parts.html' else: self.template_name = 'part/bom_upload/select_fields.html'
VariantDescriptionStockVariantDescriptionStock