Skip to content

Commit

Permalink
Add RelatedLinks inline to Manifest admin
Browse files Browse the repository at this point in the history
  • Loading branch information
blms committed Dec 5, 2023
1 parent cd1550e commit 87f80b4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion apps/iiif/manifests/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from import_export.admin import ImportExportModelAdmin
from import_export.widgets import ManyToManyWidget, ForeignKeyWidget
from django_summernote.admin import SummernoteModelAdmin
from .models import Manifest, Note, ImageServer
from .models import Manifest, Note, ImageServer, RelatedLink
from .forms import ManifestAdminForm
from .views import AddToCollectionsView
from ..kollections.models import Collection
Expand All @@ -32,6 +32,17 @@ class Meta: # pylint: disable=too-few-public-methods, missing-class-docstring
'pdf', 'metadata', 'attribution', 'logo', 'logo_url', 'license', 'viewingdirection', 'collection_id'
)


class RelatedLinksInline(admin.TabularInline):
model = RelatedLink
fields = (
"link",
"data_type",
"format",
)
extra = 1
min_num = 0

class ManifestAdmin(ImportExportModelAdmin, SummernoteModelAdmin, admin.ModelAdmin):
"""Django admin configuration for manifests"""
resource_class = ManifestResource
Expand All @@ -42,6 +53,7 @@ class ManifestAdmin(ImportExportModelAdmin, SummernoteModelAdmin, admin.ModelAdm
summernote_fields = ('summary',)
form = ManifestAdminForm
actions = ['add_to_collections_action']
inlines = [RelatedLinksInline]

def add_to_collections_action(self, request, queryset):
"""Action choose manifests to add to collections"""
Expand Down

0 comments on commit 87f80b4

Please sign in to comment.