X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/f1ca816d6a3c478d7d0f8018a57aa6b8a0762201..f1875769ae80dc4d9fd63af069d85ba2631f1876:/src/annoy/admin.py diff --git a/src/annoy/admin.py b/src/annoy/admin.py index 8470a1203..ab7be6aca 100644 --- a/src/annoy/admin.py +++ b/src/annoy/admin.py @@ -1,5 +1,6 @@ from django.contrib import admin from django import forms +from admin_ordering.admin import OrderableAdmin from modeltranslation.admin import TranslationAdmin from . import models @@ -40,3 +41,16 @@ class DynamicTextInsertAdmin(admin.ModelAdmin): admin.site.register(models.DynamicTextInsert, DynamicTextInsertAdmin) + + +class MediaInsertTextInline(OrderableAdmin, admin.TabularInline): + model = models.MediaInsertText + extra = 0 + min_num = 1 + + +@admin.register(models.MediaInsertSet) +class MediaInsertSetAdmin(admin.ModelAdmin): + list_display = ['file_format', 'etag'] + inlines = [MediaInsertTextInline] + readonly_fields = ['etag']