From 7e057a2b05f99fefb0bbd9496ccb873a1fa9724b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 21 Sep 2024 14:20:05 +0200 Subject: 🩹 minor improvments on sheets - add getter for templates and index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- archaeological_operations/models.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'archaeological_operations/models.py') diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index fcfbb5e54..f4430a8f1 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -423,6 +423,7 @@ class ArchaeologicalSite( "cached_remains": "remains", "collaborators__pk": "collaborators__pk", # dynamic_table_documents "discoverer_id": "discoverer_id", # dynamic_table_documents + "types__label": "types__label", } # alternative names of fields for searches @@ -486,7 +487,7 @@ class ArchaeologicalSite( pgettext_lazy("key for text search", "comment"), "comment__iexact" ), "precise_locality": SearchAltName( - pgettext_lazy("key for text search", "locality"), "precise_locality__iexact" + pgettext_lazy("key for text search", "address"), "precise_locality__iexact" ), "locality_ngi": SearchAltName( pgettext_lazy("key for text search", "locality-ngi"), "locality_ngi__iexact" @@ -627,7 +628,7 @@ class ArchaeologicalSite( comment = models.TextField(_("Comment"), blank=True, default="") description = models.TextField(_("Description"), blank=True, default="") public_description = models.TextField(_("Public description"), blank=True, default="") - precise_locality = models.TextField(_("Precise locality"), blank=True, default="") + precise_locality = models.TextField(_("Address"), blank=True, default="") locality_ngi = models.TextField( _("National Geographic Institute locality"), blank=True, default="" ) @@ -717,6 +718,18 @@ class ArchaeologicalSite( return self.top_operations.all()[0] return + @property + def rendered_towns_list(self): + return ", ".join([str(town) for town in self.towns.all()]) + + @property + def rendered_types_list(self): + return ", ".join([typ.label for typ in self.types.all()]) + + @property + def rendered_periods_list(self): + return ", ".join([period.label for period in self.periods.all()]) + def public_representation(self): dct = super(ArchaeologicalSite, self).public_representation() dct.update( -- cgit v1.2.3