summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
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
commit7e057a2b05f99fefb0bbd9496ccb873a1fa9724b (patch)
tree5d839854faa8fbc4063ec8ec068dd9b9ce3c6af0
parent6779a76ce977ce7dcd9afeba59dcee7f6b9da6b7 (diff)
downloadIshtar-7e057a2b05f99fefb0bbd9496ccb873a1fa9724b.tar.bz2
Ishtar-7e057a2b05f99fefb0bbd9496ccb873a1fa9724b.zip
🩹 minor improvments on sheets - add getter for templates and index
-rw-r--r--archaeological_context_records/templates/ishtar/sheet_contextrecord.html13
-rw-r--r--archaeological_operations/forms.py4
-rw-r--r--archaeological_operations/models.py17
-rw-r--r--archaeological_operations/templates/ishtar/sheet_site.html14
4 files changed, 33 insertions, 15 deletions
diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
index 17f063fa3..aea498b8a 100644
--- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
+++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
@@ -1,7 +1,7 @@
{% extends "ishtar/sheet.html" %}
{% load i18n ishtar_helpers window_field window_header window_tables window_field %}
-{% block head_title %}<strong>{% trans "Context Record" %}</strong> - {{item.full_label}}{% endblock %}
+{% block head_title %}<strong>{% trans "Context Record" %}</strong> - {{item.cached_label}}{% endblock %}
{% block toolbar %}
{% window_nav item window_id 'show-contextrecord' 'record_modify' 'show-historized-contextrecord' 'revert-contextrecord' previous next 1 %}
@@ -122,16 +122,17 @@
<div class="card float-left col-12 col-md-6 col-lg-4">
{% include "ishtar/blocks/window_image.html" %}
<div class="card-body">
- {% if item.complete_identifier %}<p class="window-refs"
- title="{% trans 'Complete identifier' %}">
- <strong>{{ item.complete_identifier }}</strong></p>{% endif %}
+ <p class="window-refs"
+ title="{% trans 'Identifier' %}">
+ <strong>{{ item.cached_label }}</strong></p>
<p class='window-refs' title="{% trans 'Parcel' %}">{{ item.parcel.short_label }}</p>
- <p class="window-refs">{{ item.label|default:"" }}</p>
+ {% if item.label != item.external_id %}
+ <p class="window-refs">{{ item.label|default:"" }}</p>{% endif %}
{% include "ishtar/blocks/sheet_external_id.html" %}
</div>
</div>
<div class='row'>
- {% field_flex_2 "Complete ID" item.full_label %}
+ {% if item.cached_label != item.complete_identifier %}{% field_flex_2 "Complete ID" item.complete_identifier %}{% endif %}
{% field_flex_2 "Type" item.unit %}
{% field_flex_detail _("Excavator") item.excavator %}
{% field_flex_full "General comment" item.comment "<pre>" "</pre>" has_image %}
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>