X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/c48ff2d3e64065793c24cfb8ae151f02b8e6646a..bbf66a1eb672e6029f7d58780d3689005215d03c:/src/catalogue/admin.py diff --git a/src/catalogue/admin.py b/src/catalogue/admin.py index 8daad6e0..bd783b99 100644 --- a/src/catalogue/admin.py +++ b/src/catalogue/admin.py @@ -1,21 +1,21 @@ -# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# from django.contrib import admin +from . import models +from .wikidata import WikidataAdminMixin -from catalogue import models -class BookAdmin(admin.ModelAdmin): - list_display = ['title', 'public', '_published', '_new_publishable', 'project'] - list_filter = ['public', '_published', '_new_publishable', 'project'] - prepopulated_fields = {'slug': ['title']} - search_fields = ['title'] +class AuthorAdmin(WikidataAdminMixin, admin.ModelAdmin): + list_display = "first_name", "last_name", "notes" + search_fields = ["first_name", "last_name", "wikidata"] + prepopulated_fields = {"slug": ("first_name", "last_name")} -admin.site.register(models.Project) -admin.site.register(models.Book, BookAdmin) -admin.site.register(models.Chunk) -admin.site.register(models.Chunk.tag_model) +admin.site.register(models.Author, AuthorAdmin) + + +class BookAdmin(WikidataAdminMixin, admin.ModelAdmin): + list_display = "title", "notes" + autocomplete_fields = ["authors", "translators"] + prepopulated_fields = {"slug": ("title",)} -admin.site.register(models.Image) -admin.site.register(models.Image.tag_model) + +admin.site.register(models.Book, BookAdmin)