X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/1b3b64f7afe8ee6944f1f2d82ee5dabf3d8bb48b..bbf66a1eb672e6029f7d58780d3689005215d03c:/src/catalogue/admin.py?ds=inline diff --git a/src/catalogue/admin.py b/src/catalogue/admin.py index 189cd718..bd783b99 100644 --- a/src/catalogue/admin.py +++ b/src/catalogue/admin.py @@ -1,17 +1,21 @@ from django.contrib import admin from . import models +from .wikidata import WikidataAdminMixin +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")} -class AuthorAdmin(admin.ModelAdmin): - search_fields = ['name'] admin.site.register(models.Author, AuthorAdmin) -class BookAdmin(admin.ModelAdmin): - raw_id_fields = ['authors'] - autocomplete_fields = ['translators'] +class BookAdmin(WikidataAdminMixin, admin.ModelAdmin): + list_display = "title", "notes" + autocomplete_fields = ["authors", "translators"] + prepopulated_fields = {"slug": ("title",)} -admin.site.register(models.Book, BookAdmin) +admin.site.register(models.Book, BookAdmin)