diff --git a/InvenTree/InvenTree/models.py b/InvenTree/InvenTree/models.py index 7129a8599a..2b49f7b908 100644 --- a/InvenTree/InvenTree/models.py +++ b/InvenTree/InvenTree/models.py @@ -187,11 +187,8 @@ def FilterChildren(queryset, parent): elif str2bool(parent, False): return queryset.filter(parent=None) else: - try: - parent_id = int(parent) - if parent_id == 0: - return queryset.filter(parent=None) - else: - return queryset.filter(parent=parent_id) - except: - return queryset + parent_id = int(parent) + if parent_id == 0: + return queryset.filter(parent=None) + else: + return queryset.filter(parent=parent_id) diff --git a/InvenTree/build/tests.py b/InvenTree/build/tests.py index 43281c34b7..1918ce9b27 100644 --- a/InvenTree/build/tests.py +++ b/InvenTree/build/tests.py @@ -6,8 +6,6 @@ from django.test import TestCase from .models import Build from part.models import Part -# Create your tests here. - class BuildTestSimple(TestCase): @@ -56,4 +54,3 @@ class BuildTestSimple(TestCase): def test_required_parts(self): # TODO - Generate BOM for test part pass - \ No newline at end of file diff --git a/InvenTree/company/tests.py b/InvenTree/company/tests.py index f1aa580c12..925d9eb104 100644 --- a/InvenTree/company/tests.py +++ b/InvenTree/company/tests.py @@ -16,4 +16,4 @@ class CompanySimpleTest(TestCase): def test_company_model(self): c = Company.objects.get(pk=1) self.assertEqual(c.name, 'ABC Co.') - self.assertEqual(c.get_absolute_url(), '/company/1/') \ No newline at end of file + self.assertEqual(c.get_absolute_url(), '/company/1/') diff --git a/InvenTree/part/forms.py b/InvenTree/part/forms.py index 28d9941326..4d7d05bba1 100644 --- a/InvenTree/part/forms.py +++ b/InvenTree/part/forms.py @@ -89,21 +89,21 @@ class EditBomItemForm(HelperForm): class EditSupplierPartForm(HelperForm): - class Meta: - model = SupplierPart - fields = [ - 'supplier', - 'SKU', - 'part', - 'description', - 'URL', - 'manufacturer', - 'MPN', - 'note', - 'single_price', - 'base_cost', - 'multiple', - 'minimum', - 'packaging', - 'lead_time' - ] + class Meta: + model = SupplierPart + fields = [ + 'supplier', + 'SKU', + 'part', + 'description', + 'URL', + 'manufacturer', + 'MPN', + 'note', + 'single_price', + 'base_cost', + 'multiple', + 'minimum', + 'packaging', + 'lead_time' + ] diff --git a/InvenTree/part/test_bom_item.py b/InvenTree/part/test_bom_item.py index d519b4c4fe..e3d7aa78ce 100644 --- a/InvenTree/part/test_bom_item.py +++ b/InvenTree/part/test_bom_item.py @@ -1,10 +1,7 @@ from django.test import TestCase -from .models import Part, BomItem - class BomItemTest(TestCase): def setUp(self): pass - \ No newline at end of file diff --git a/InvenTree/part/test_category.py b/InvenTree/part/test_category.py index 34efa4b2d1..9fee29332c 100644 --- a/InvenTree/part/test_category.py +++ b/InvenTree/part/test_category.py @@ -1,7 +1,6 @@ from django.test import TestCase from .models import Part, PartCategory -from .models import rename_part_image class CategoryTest(TestCase): @@ -11,16 +10,16 @@ class CategoryTest(TestCase): def setUp(self): self.p1 = PartCategory.objects.create(name='A', - description='Most highest level', - parent=None) + description='Most highest level', + parent=None) self.p2 = PartCategory.objects.create(name='B', - description='Sits under second', - parent=self.p1) + description='Sits under second', + parent=self.p1) self.p3 = PartCategory.objects.create(name='C', - description='Third tier category', - parent=self.p2) + description='Third tier category', + parent=self.p2) # Add two parts in p2 Part.objects.create(name='Flange', category=self.p2) @@ -64,4 +63,4 @@ class CategoryTest(TestCase): self.assertEqual(self.p1.partcount, 3) self.assertEqual(self.p2.partcount, 3) - self.assertEqual(self.p3.partcount, 1) \ No newline at end of file + self.assertEqual(self.p3.partcount, 1) diff --git a/InvenTree/part/test_part.py b/InvenTree/part/test_part.py index 540c98bfa4..c9ed2fd7b3 100644 --- a/InvenTree/part/test_part.py +++ b/InvenTree/part/test_part.py @@ -2,6 +2,7 @@ from django.test import TestCase from .models import Part, PartCategory + class SimplePartTest(TestCase): def setUp(self): @@ -19,4 +20,4 @@ class SimplePartTest(TestCase): def test_category(self): self.assertEqual(self.px.category_path, '') - self.assertEqual(self.pz.category_path, 'TLC') \ No newline at end of file + self.assertEqual(self.pz.category_path, 'TLC') diff --git a/InvenTree/part/test_supplier_part.py b/InvenTree/part/test_supplier_part.py index abdae9ed09..c34b788257 100644 --- a/InvenTree/part/test_supplier_part.py +++ b/InvenTree/part/test_supplier_part.py @@ -1,9 +1,7 @@ from django.test import TestCase -from .models import Part, SupplierPart - class SupplierPartTest(TestCase): def setUp(self): - pass \ No newline at end of file + pass diff --git a/InvenTree/part/urls.py b/InvenTree/part/urls.py index 75d5041b9c..14a15625f9 100644 --- a/InvenTree/part/urls.py +++ b/InvenTree/part/urls.py @@ -70,23 +70,3 @@ part_urls = [ # Top level part list (display top level parts and categories) url(r'^.*$', views.PartIndex.as_view(), name='part-index'), ] - -""" -part_param_urls = [ - # Detail of a single part parameter - url(r'^(?P[0-9]+)/?$', views.PartParamDetail.as_view(), name='partparameter-detail'), - - # Parameters associated with a particular part - url(r'^\?.*/?$', views.PartParamList.as_view()), - url(r'^$', views.PartParamList.as_view()), -] - -part_param_template_urls = [ - # Detail of a single part field template - url(r'^(?P[0-9]+)/?$', views.PartTemplateDetail.as_view(), name='partparametertemplate-detail'), - - # List all part field templates - url(r'^\?.*/?$', views.PartTemplateList.as_view()), - url(r'^$', views.PartTemplateList.as_view()) -] -""" diff --git a/InvenTree/stock/test_stock_item.py b/InvenTree/stock/test_stock_item.py index 0b4501e258..becd6e4e69 100644 --- a/InvenTree/stock/test_stock_item.py +++ b/InvenTree/stock/test_stock_item.py @@ -1,4 +1,7 @@ from django.test import TestCase -# Create your tests here. +class StockItemTest(TestCase): + + def setUp(self): + pass diff --git a/InvenTree/stock/test_stock_location.py b/InvenTree/stock/test_stock_location.py index 7ce503c2dd..0a89aeed33 100644 --- a/InvenTree/stock/test_stock_location.py +++ b/InvenTree/stock/test_stock_location.py @@ -1,3 +1,7 @@ from django.test import TestCase -# Create your tests here. + +class StockLocationTest(TestCase): + + def setUp(self): + pass diff --git a/InvenTree/stock/test_stock_tracking.py b/InvenTree/stock/test_stock_tracking.py index 0b4501e258..15b79cbe66 100644 --- a/InvenTree/stock/test_stock_tracking.py +++ b/InvenTree/stock/test_stock_tracking.py @@ -1,4 +1,7 @@ from django.test import TestCase -# Create your tests here. +class StockTrackingTest(TestCase): + + def setUp(self): + pass