X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/73de75f6bdf2c2deb04f7c94ae62a2684af95759..3c066ba7e839ef23861030410b03a3ff3cd70e6f:/src/depot/admin.py?ds=inline diff --git a/src/depot/admin.py b/src/depot/admin.py index eebf0102..6bfd385a 100644 --- a/src/depot/admin.py +++ b/src/depot/admin.py @@ -1,3 +1,4 @@ +from admin_ordering.admin import OrderableAdmin from django.contrib import admin from . import models @@ -5,3 +6,29 @@ from . import models @admin.register(models.Package) class PackageAdmin(admin.ModelAdmin): raw_id_fields = ['books'] + + +class MediaInsertTextInline(OrderableAdmin, admin.TabularInline): + model = models.MediaInsertText + extra = 0 + + +class PriceLevelInline(OrderableAdmin, admin.TabularInline): + model = models.PriceLevel + extra = 0 + + +@admin.register(models.Site) +class SiteAdmin(admin.ModelAdmin): + inlines = [ + MediaInsertTextInline, + PriceLevelInline, + ] + +@admin.register(models.SiteBookPublish) +class SiteBookPublishAdmin(admin.ModelAdmin): + list_display = ['created_at', 'site_book', 'user', 'status', 'started_at', 'finished_at'] + list_filter = ['status', 'site_book__site'] + search_fields = ['book', 'user'] + date_hierarchy = 'started_at' + raw_id_fields = ['site_book']