X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/c8d364d4d3331d03a079d200887e5462279fd875..f1875769ae80dc4d9fd63af069d85ba2631f1876:/src/annoy/admin.py diff --git a/src/annoy/admin.py b/src/annoy/admin.py index 8255e96a5..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 @@ -9,7 +10,7 @@ class BannerAdmin(TranslationAdmin): 'place', 'text', 'text_color', 'background_color', 'priority', 'since', 'until', - 'show_members', 'staff_preview'] + 'show_members', 'staff_preview', 'only_authenticated'] admin.site.register(models.Banner, BannerAdmin) @@ -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']