Reverse url lookup for Part model

This commit is contained in:
Oliver Walters committed 2019-04-25 01:00:01 +10:00
1 parent f9db3b680d
commit 0bc5617825
3 files changed
+23 -4

No files matched your search

+1 -1
View File
@@ -89,7 +89,7 @@ class Part(models.Model):
"""
def get_absolute_url(self):
return '/part/{id}/'.format(id=self.id)
return reverse('part-detail', kwargs={'pk': self.id})
# Short name of the part
name = models.CharField(max_length=100, unique=True, help_text='Part name (must be unique)')