2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-13 08:21:26 +00:00

Reverse url lookup for Part model

This commit is contained in:
Oliver Walters
2019-04-25 00:59:34 +10:00
parent f9db3b680d
commit 0bc5617825
3 changed files with 23 additions and 4 deletions

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)')