X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/f5129e7c47fa5fcf0a20f04249b90afcbc54cb9c..f1875769ae80dc4d9fd63af069d85ba2631f1876:/src/annoy/admin.py diff --git a/src/annoy/admin.py b/src/annoy/admin.py index 7a82d6867..ab7be6aca 100644 --- a/src/annoy/admin.py +++ b/src/annoy/admin.py @@ -1,19 +1,38 @@ from django.contrib import admin from django import forms +from admin_ordering.admin import OrderableAdmin from modeltranslation.admin import TranslationAdmin from . import models class BannerAdmin(TranslationAdmin): - list_display = ['place', 'text', 'priority', 'since', 'until', 'show_members', 'staff_preview'] + list_display = [ + 'place', 'text', + 'text_color', 'background_color', + 'priority', 'since', 'until', + 'show_members', 'staff_preview', 'only_authenticated'] + - admin.site.register(models.Banner, BannerAdmin) +class DTITForm(forms.ModelForm): + class Meta: + model = models.DynamicTextInsertText + fields = '__all__' + widgets = { + 'background_color': forms.TextInput(attrs={"type": "color"}), + 'text_color': forms.TextInput(attrs={"type": "color"}), + } + + class DynamicTextInsertTextInline(admin.TabularInline): model = models.DynamicTextInsertText - fields = ['text', 'image', 'background_color', 'text_color'] + form = DTITForm + fields = ['text', 'image', 'own_colors', 'background_color', 'text_color'] + extra = 0 + min_num = 1 + class DynamicTextInsertAdmin(admin.ModelAdmin): @@ -22,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']