diff options
author | Matthew Lemon <y@yulqen.org> | 2024-08-03 21:38:07 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-08-03 21:38:45 +0100 |
commit | 82557e058b9c98424d612bf0eaa917e4fe222480 (patch) | |
tree | 547e74ba2c682655905df374010f103e9669336f /pyblackbird_cc/resources | |
parent | 597c58300422aadcdc58a027e7334dd3cf3600a9 (diff) |
Add admin models for PDFResource and PDFPageSnapshot
Expand the admin interface to include PDFResource and PDFPageSnapshot models. The new admin classes define `list_display` attributes to manage displayed columns in the admin list views.
Diffstat (limited to 'pyblackbird_cc/resources')
-rw-r--r-- | pyblackbird_cc/resources/admin.py | 12 | ||||
-rw-r--r-- | pyblackbird_cc/resources/models.py | 4 |
2 files changed, 15 insertions, 1 deletions
diff --git a/pyblackbird_cc/resources/admin.py b/pyblackbird_cc/resources/admin.py index a9662ee..ac45efb 100644 --- a/pyblackbird_cc/resources/admin.py +++ b/pyblackbird_cc/resources/admin.py @@ -1,7 +1,7 @@ # Register your models here. from django.contrib import admin -from pyblackbird_cc.resources.models import Resource, ResourceSubcategory +from pyblackbird_cc.resources.models import Resource, ResourceSubcategory, PDFPageSnapshot, PDFResource from pyblackbird_cc.resources.models import ResourceCategory from pyblackbird_cc.resources.models import ResourceType @@ -24,3 +24,13 @@ class ResourceSubcategoryAdmin(admin.ModelAdmin): @admin.register(Resource) class ResourceAdmin(admin.ModelAdmin): pass + + +@admin.register(PDFResource) +class PDFResourceAdmin(admin.ModelAdmin): + list_display = ["resource", "file_name", "file_size"] + + +@admin.register(PDFPageSnapshot) +class PDFPageSnapshotAdmin(admin.ModelAdmin): + list_display = ["file_name", "pdf_file"] diff --git a/pyblackbird_cc/resources/models.py b/pyblackbird_cc/resources/models.py index 31085c0..f938cb4 100644 --- a/pyblackbird_cc/resources/models.py +++ b/pyblackbird_cc/resources/models.py @@ -152,6 +152,7 @@ class PDFResource(models.Model): file_size = models.IntegerField(null=False) class Meta: + verbose_name_plural = "PDF Resources" unique_together = ("resource", "file_name") def __str__(self): @@ -171,5 +172,8 @@ class PDFPageSnapshot(models.Model): related_name="pdf_page_snapshots", ) + class Meta: + verbose_name_plural = "PDF Page Snapshots" + def __str__(self): return self.name |