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

Reverse lookup for part category URL

- Added some test cases for PartCategory model
This commit is contained in:
Oliver Walters
2019-04-25 00:28:40 +10:00
parent a2d4403968
commit f9db3b680d
3 changed files with 71 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import tablib
from django.utils.translation import gettext_lazy as _
from django.core.exceptions import ValidationError
from django.urls import reverse
from django.db import models
from django.core.validators import MinValueValidator
@ -25,7 +26,7 @@ class PartCategory(InvenTreeTree):
"""
def get_absolute_url(self):
return '/part/category/{id}/'.format(id=self.id)
return reverse('category-detail', kwargs={'pk': self.id})
class Meta:
verbose_name = "Part Category"