2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-17 04:25:42 +00:00

Annotate models with their API list view

- It will make sense, trust me
This commit is contained in:
Oliver
2021-06-25 00:17:58 +10:00
parent b273dc613b
commit 04374c71c2
12 changed files with 153 additions and 5 deletions

View File

@ -60,6 +60,10 @@ class Build(MPTTModel):
responsible: User (or group) responsible for completing the build
"""
@staticmethod
def get_api_url():
return reverse('api-build-list')
OVERDUE_FILTER = Q(status__in=BuildStatus.ACTIVE_CODES) & ~Q(target_date=None) & Q(target_date__lte=datetime.now().date())
class Meta:
@ -1117,6 +1121,10 @@ class BuildItem(models.Model):
quantity: Number of units allocated
"""
@staticmethod
def get_api_url():
return reverse('api-build-item-list')
def get_absolute_url(self):
# TODO - Fix!
return '/build/item/{pk}/'.format(pk=self.id)