From: Radek Czajka Date: Mon, 4 Apr 2022 10:26:51 +0000 (+0200) Subject: Catalogue: sorting and searching. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/90b6ca1350fbb780696434cb8381d3ab8f859979 Catalogue: sorting and searching. --- diff --git a/src/catalogue/admin.py b/src/catalogue/admin.py index 8ce330ce..3e80557d 100644 --- a/src/catalogue/admin.py +++ b/src/catalogue/admin.py @@ -40,7 +40,12 @@ class BookAdmin(WikidataAdminMixin, NumericFilterModelAdmin): "priority", "wikidata_link", ] - search_fields = ["title", "wikidata", "authors__first_name", "authors__last_name", "translators__first_name", "translators__last_name"] + search_fields = [ + "title", "wikidata", + "authors__first_name", "authors__last_name", + "translators__first_name", "translators__last_name", + "scans_source", "text_source", "notes", "estimate_source", + ] autocomplete_fields = ["authors", "translators", "based_on", "collections", "epochs", "genres", "kinds"] prepopulated_fields = {"slug": ("title",)} list_filter = [ diff --git a/src/catalogue/models.py b/src/catalogue/models.py index 2ceb110b..45250bcf 100644 --- a/src/catalogue/models.py +++ b/src/catalogue/models.py @@ -163,9 +163,11 @@ class Book(WikidataMixin, models.Model): def authors_str(self): return ", ".join(str(author) for author in self.authors.all()) + authors_str.admin_order_field = 'authors__last_name' def translators_str(self): return ", ".join(str(author) for author in self.translators.all()) + translators_str.admin_order_field = 'translators__last_name' def get_estimated_costs(self): return {