X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/c30cd74f1f4dcf0bfbabb0e5a739bcdf236b4946..2dd9e6498b5e0bd5c0bd882db02be9768c34c019:/src/depot/admin.py?ds=sidebyside diff --git a/src/depot/admin.py b/src/depot/admin.py index 35f721bd..6bfd385a 100644 --- a/src/depot/admin.py +++ b/src/depot/admin.py @@ -1,10 +1,34 @@ +from admin_ordering.admin import OrderableAdmin from django.contrib import admin from . import models @admin.register(models.Package) class PackageAdmin(admin.ModelAdmin): - filter_horizontal = ['books'] - pass - -# Register your models here. + 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']