From: Radek Czajka Date: Fri, 4 Nov 2022 09:51:41 +0000 (+0100) Subject: Export authors names in CSV. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/622862bc33b5e1ad606ed57681c18d40f3e38fe7?ds=sidebyside;hp=6251ad833bb249f4cbc52e1676c9d6a2b7d95fff Export authors names in CSV. --- diff --git a/src/catalogue/admin.py b/src/catalogue/admin.py index 958230b4..96af8c13 100644 --- a/src/catalogue/admin.py +++ b/src/catalogue/admin.py @@ -187,8 +187,10 @@ class BookAdmin(WikidataAdminMixin, NumericFilterModelAdmin): "wikidata", "slug", "title", - "authors_str", # authors? - "translators_str", # translators? + "authors_first_names", + "authors_last_names", + "translators_first_names", + "translators_last_names", "language", "based_on", "scans_source", diff --git a/src/catalogue/models.py b/src/catalogue/models.py index 4544fc68..d3766d5a 100644 --- a/src/catalogue/models.py +++ b/src/catalogue/models.py @@ -236,6 +236,18 @@ class Book(WikidataModel): translators_str.admin_order_field = 'translators__last_name' translators_str.short_description = _('Translator') + def authors_first_names(self): + return ', '.join(a.first_name for a in self.authors.all()) + + def authors_last_names(self): + return ', '.join(a.last_name for a in self.authors.all()) + + def translators_first_names(self): + return ', '.join(a.first_name for a in self.translators.all()) + + def translators_last_names(self): + return ', '.join(a.last_name for a in self.translators.all()) + def get_estimated_costs(self): return { work_type: work_type.calculate(self)