Annotate models with their API list view

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

No files matched your search

+8
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)