diff options
Diffstat (limited to 'pyblackbird_cc/resources/models.py')
-rw-r--r-- | pyblackbird_cc/resources/models.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pyblackbird_cc/resources/models.py b/pyblackbird_cc/resources/models.py index 05a848c..31085c0 100644 --- a/pyblackbird_cc/resources/models.py +++ b/pyblackbird_cc/resources/models.py @@ -1,4 +1,5 @@ from django.db import models +from django.urls import reverse CURRICULUM_CHOICES = [ ("No curriculum", "No curriculum"), @@ -98,6 +99,9 @@ class Resource(models.Model): sh = [sh for sh in rs.values_list("pdf_page_snapshots__file_name", flat=True)] return [s for s in sh if s] + def get_absolute_url(self): + return reverse("resources:resource_detail", kwargs={"resource_id": self.pk}) + class ResourceType(models.Model): name = models.CharField(max_length=255, null=False) |