-# 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)