diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-21 14:20:05 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-09-21 14:20:05 +0200 |
commit | 7e057a2b05f99fefb0bbd9496ccb873a1fa9724b (patch) | |
tree | 5d839854faa8fbc4063ec8ec068dd9b9ce3c6af0 /archaeological_operations | |
parent | 6779a76ce977ce7dcd9afeba59dcee7f6b9da6b7 (diff) | |
download | Ishtar-7e057a2b05f99fefb0bbd9496ccb873a1fa9724b.tar.bz2 Ishtar-7e057a2b05f99fefb0bbd9496ccb873a1fa9724b.zip |
🩹 minor improvments on sheets - add getter for templates and index
Diffstat (limited to 'archaeological_operations')
-rw-r--r-- | archaeological_operations/forms.py | 4 | ||||
-rw-r--r-- | archaeological_operations/models.py | 17 | ||||
-rw-r--r-- | archaeological_operations/templates/ishtar/sheet_site.html | 14 |
3 files changed, 26 insertions, 9 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 18e588d5a..433f3fd54 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -1229,7 +1229,7 @@ class SiteSelect(GeoItemSelect): reverse_lazy('autocomplete-operation'), associated_model=models.Operation), validators=[valid_id(models.Operation)]) - precise_locality = forms.CharField(label=_("Precise locality"), max_length=200, + precise_locality = forms.CharField(label=_("Address"), max_length=200, required=False) locality_ngi = forms.CharField( label=_("National Geographic Institute locality"), max_length=200, @@ -1375,7 +1375,7 @@ class SiteForm(CustomForm, ManageOldType): model=Town, label=_("Towns"), required=False, remote=True ) precise_locality = forms.CharField( - label=_("Precise locality"), + label=_("Address"), widget=forms.Textarea, required=False ) locality_ngi = forms.CharField( 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( diff --git a/archaeological_operations/templates/ishtar/sheet_site.html b/archaeological_operations/templates/ishtar/sheet_site.html index 718947e19..f87888655 100644 --- a/archaeological_operations/templates/ishtar/sheet_site.html +++ b/archaeological_operations/templates/ishtar/sheet_site.html @@ -25,9 +25,9 @@ {% if item.complete_identifier %}<p class="window-refs" title="{% trans 'Complete identifier' %}"> <strong>{{ item.complete_identifier }}</strong></p>{% endif %} - </div> - <div class="col text-muted"> - {% include "ishtar/blocks/sheet_external_id.html" %} + <p class="col text-muted"> + {% include "ishtar/blocks/sheet_external_id.html" %} + </p> </div> </div> <p class="card-text"> @@ -51,8 +51,12 @@ {% field_flex_multiple_obj "Cultural attributions" item 'cultural_attributions' %} {% field_flex_detail _("Discoverer") item.discoverer %} {% field_flex_multiple "Collaborators" item.collaborators %} + {% if item.description == item.public_description %} + {% field_flex_full _("Description/Public description") item.description "<pre>" "</pre>" %} + {% else %} {% field_flex_full _("Description") item.description "<pre>" "</pre>" %} - {% field_flex_full _("Public description") item.description "<pre>" "</pre>" %} + {% field_flex_full _("Public description") item.public_description "<pre>" "</pre>" %} + {% endif %} {% field_flex_full "Comment" item.comment "<pre>" "</pre>" %} </div> @@ -83,7 +87,7 @@ {% else %} {% field_flex_detail_multiple_full "Towns" item.towns %} {% endif %} - {% field_flex_full _("Precise locality") item.precise_locality "<pre>" "</pre>" %} + {% field_flex_full _("Address") item.precise_locality "<pre>" "</pre>" %} {% field_flex_full "National Geographic Institute locality" item.locality_ngi "<pre>" "</pre>" %} {% field_flex_full "Cadastral locality" item.locality_cadastral "<pre>" "</pre>" %} </div> |