reverse URL lookup for BomItem and SupplierPart

- created empty test files
This commit is contained in:
Oliver Walters 2019-04-25 01:05:08 +10:00
parent 0bc5617825
commit e6617fef80
3 changed files with 21 additions and 2 deletions

View File

@ -337,7 +337,7 @@ class BomItem(models.Model):
"""
def get_absolute_url(self):
return '/part/bom/{id}/'.format(id=self.id)
return reverse('bom-detail', kwargs={'pk': self.id})
# A link to the parent part
# Each part will get a reverse lookup field 'bom_items'
@ -386,7 +386,7 @@ class SupplierPart(models.Model):
"""
def get_absolute_url(self):
return "/supplier-part/{id}/".format(id=self.id)
return reverse('supplier-part-detail', kwargs={'pk': self.id})
class Meta:
unique_together = ('part', 'supplier', 'SKU')

View File

@ -0,0 +1,10 @@
from django.test import TestCase
from .models import Part, BomItem
class BomItemTest(TestCase):
def setUp(self):
pass

View File

@ -0,0 +1,9 @@
from django.test import TestCase
from .models import Part, SupplierPart
class SupplierPartTest(TestCase):
def setUp(self):
pass