mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
PEP fixes
This commit is contained in:
parent
7c91c9ba79
commit
7b68310d73
@ -187,11 +187,8 @@ def FilterChildren(queryset, parent):
|
|||||||
elif str2bool(parent, False):
|
elif str2bool(parent, False):
|
||||||
return queryset.filter(parent=None)
|
return queryset.filter(parent=None)
|
||||||
else:
|
else:
|
||||||
try:
|
parent_id = int(parent)
|
||||||
parent_id = int(parent)
|
if parent_id == 0:
|
||||||
if parent_id == 0:
|
return queryset.filter(parent=None)
|
||||||
return queryset.filter(parent=None)
|
else:
|
||||||
else:
|
return queryset.filter(parent=parent_id)
|
||||||
return queryset.filter(parent=parent_id)
|
|
||||||
except:
|
|
||||||
return queryset
|
|
||||||
|
@ -6,8 +6,6 @@ from django.test import TestCase
|
|||||||
from .models import Build
|
from .models import Build
|
||||||
from part.models import Part
|
from part.models import Part
|
||||||
|
|
||||||
# Create your tests here.
|
|
||||||
|
|
||||||
|
|
||||||
class BuildTestSimple(TestCase):
|
class BuildTestSimple(TestCase):
|
||||||
|
|
||||||
@ -56,4 +54,3 @@ class BuildTestSimple(TestCase):
|
|||||||
def test_required_parts(self):
|
def test_required_parts(self):
|
||||||
# TODO - Generate BOM for test part
|
# TODO - Generate BOM for test part
|
||||||
pass
|
pass
|
||||||
|
|
@ -16,4 +16,4 @@ class CompanySimpleTest(TestCase):
|
|||||||
def test_company_model(self):
|
def test_company_model(self):
|
||||||
c = Company.objects.get(pk=1)
|
c = Company.objects.get(pk=1)
|
||||||
self.assertEqual(c.name, 'ABC Co.')
|
self.assertEqual(c.name, 'ABC Co.')
|
||||||
self.assertEqual(c.get_absolute_url(), '/company/1/')
|
self.assertEqual(c.get_absolute_url(), '/company/1/')
|
||||||
|
@ -89,21 +89,21 @@ class EditBomItemForm(HelperForm):
|
|||||||
|
|
||||||
class EditSupplierPartForm(HelperForm):
|
class EditSupplierPartForm(HelperForm):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = SupplierPart
|
model = SupplierPart
|
||||||
fields = [
|
fields = [
|
||||||
'supplier',
|
'supplier',
|
||||||
'SKU',
|
'SKU',
|
||||||
'part',
|
'part',
|
||||||
'description',
|
'description',
|
||||||
'URL',
|
'URL',
|
||||||
'manufacturer',
|
'manufacturer',
|
||||||
'MPN',
|
'MPN',
|
||||||
'note',
|
'note',
|
||||||
'single_price',
|
'single_price',
|
||||||
'base_cost',
|
'base_cost',
|
||||||
'multiple',
|
'multiple',
|
||||||
'minimum',
|
'minimum',
|
||||||
'packaging',
|
'packaging',
|
||||||
'lead_time'
|
'lead_time'
|
||||||
]
|
]
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from .models import Part, BomItem
|
|
||||||
|
|
||||||
|
|
||||||
class BomItemTest(TestCase):
|
class BomItemTest(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
pass
|
pass
|
||||||
|
|
@ -1,7 +1,6 @@
|
|||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from .models import Part, PartCategory
|
from .models import Part, PartCategory
|
||||||
from .models import rename_part_image
|
|
||||||
|
|
||||||
|
|
||||||
class CategoryTest(TestCase):
|
class CategoryTest(TestCase):
|
||||||
@ -11,16 +10,16 @@ class CategoryTest(TestCase):
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.p1 = PartCategory.objects.create(name='A',
|
self.p1 = PartCategory.objects.create(name='A',
|
||||||
description='Most highest level',
|
description='Most highest level',
|
||||||
parent=None)
|
parent=None)
|
||||||
|
|
||||||
self.p2 = PartCategory.objects.create(name='B',
|
self.p2 = PartCategory.objects.create(name='B',
|
||||||
description='Sits under second',
|
description='Sits under second',
|
||||||
parent=self.p1)
|
parent=self.p1)
|
||||||
|
|
||||||
self.p3 = PartCategory.objects.create(name='C',
|
self.p3 = PartCategory.objects.create(name='C',
|
||||||
description='Third tier category',
|
description='Third tier category',
|
||||||
parent=self.p2)
|
parent=self.p2)
|
||||||
|
|
||||||
# Add two parts in p2
|
# Add two parts in p2
|
||||||
Part.objects.create(name='Flange', category=self.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.p1.partcount, 3)
|
||||||
self.assertEqual(self.p2.partcount, 3)
|
self.assertEqual(self.p2.partcount, 3)
|
||||||
self.assertEqual(self.p3.partcount, 1)
|
self.assertEqual(self.p3.partcount, 1)
|
||||||
|
@ -2,6 +2,7 @@ from django.test import TestCase
|
|||||||
|
|
||||||
from .models import Part, PartCategory
|
from .models import Part, PartCategory
|
||||||
|
|
||||||
|
|
||||||
class SimplePartTest(TestCase):
|
class SimplePartTest(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -19,4 +20,4 @@ class SimplePartTest(TestCase):
|
|||||||
|
|
||||||
def test_category(self):
|
def test_category(self):
|
||||||
self.assertEqual(self.px.category_path, '')
|
self.assertEqual(self.px.category_path, '')
|
||||||
self.assertEqual(self.pz.category_path, 'TLC')
|
self.assertEqual(self.pz.category_path, 'TLC')
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from .models import Part, SupplierPart
|
|
||||||
|
|
||||||
|
|
||||||
class SupplierPartTest(TestCase):
|
class SupplierPartTest(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
pass
|
pass
|
||||||
|
@ -70,23 +70,3 @@ part_urls = [
|
|||||||
# Top level part list (display top level parts and categories)
|
# Top level part list (display top level parts and categories)
|
||||||
url(r'^.*$', views.PartIndex.as_view(), name='part-index'),
|
url(r'^.*$', views.PartIndex.as_view(), name='part-index'),
|
||||||
]
|
]
|
||||||
|
|
||||||
"""
|
|
||||||
part_param_urls = [
|
|
||||||
# Detail of a single part parameter
|
|
||||||
url(r'^(?P<pk>[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<pk>[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())
|
|
||||||
]
|
|
||||||
"""
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
# Create your tests here.
|
|
||||||
|
|
||||||
|
class StockItemTest(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
# Create your tests here.
|
|
||||||
|
class StockLocationTest(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
# Create your tests here.
|
|
||||||
|
|
||||||
|
class StockTrackingTest(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
pass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user