summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-09-11 19:05:37 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-09-12 09:15:26 +0200
commit4e6d13e817d2389d5bb9b2a7848b6e9705e28912 (patch)
treedb671670ae807fcda792af6d242bc42edf66f171 /archaeological_finds
parente6f2a8071106a83816e4128df93762246668238d (diff)
downloadIshtar-4e6d13e817d2389d5bb9b2a7848b6e9705e28912.tar.bz2
Ishtar-4e6d13e817d2389d5bb9b2a7848b6e9705e28912.zip
🐛 sheet find: fix display for simple treatment with no container associated
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/models_finds.py6
-rw-r--r--archaeological_finds/templates/ishtar/sheet_find.html2
2 files changed, 5 insertions, 3 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index a5ff20773..53a1e3eef 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -3658,13 +3658,14 @@ class FindTreatment(models.Model):
db_table = 'archaeological_finds_find_treatments'
def location_type_label(self):
- return LOCATION_TYPE_DICT[self.location_type]
+ if self.location_type in LOCATION_TYPE_DICT:
+ return LOCATION_TYPE_DICT[self.location_type]
def generate_full_location(self):
if getattr(self, "_full_location_set", False) or self.full_location or (
not self.treatment.is_current_container_changer and
not self.treatment.is_reference_container_changer):
- return
+ return False
if self.treatment.is_current_container_changer:
if self.treatment.is_reference_container_changer:
self.location_type = "B"
@@ -3678,6 +3679,7 @@ class FindTreatment(models.Model):
self.full_location = self.container_ref.generate_full_location()
self._full_location_set = True
self.save()
+ return True
class Property(LightHistorizedItem):
diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html
index 371888317..a3ecbdc67 100644
--- a/archaeological_finds/templates/ishtar/sheet_find.html
+++ b/archaeological_finds/templates/ishtar/sheet_find.html
@@ -403,7 +403,7 @@
<td class='string'>{{ treatment.treatment_state|default_if_none:"-" }}</td>
<td class='item-list'>{% for it in items %}<span>{{it}} {{it|link_to_window:request}}</span>{% endfor %}</td>
<td class='string'>{{ treatment.person|default_if_none:"-" }}</td>
- {% if can_view_container %}<td class='string'>{% for find_treatment in treatment.get_find_treatment_list %}{% if find_treatment.find.pk == item.pk %}{{ find_treatment.full_location|default_if_none:"-" }} <span class="badge badge-secondary">{{find_treatment.location_type_label}}</span>{% endif %}{% endfor %}</td>{% endif %}
+ {% if can_view_container %}<td class='string'>{% for find_treatment in treatment.get_find_treatment_list %}{% if find_treatment.find.pk == item.pk %}{{ find_treatment.full_location|default_if_none:"-" }}{% if find_treatment.location_type_label %} <span class="badge badge-secondary">{{find_treatment.location_type_label}}</span>{% endif %}{% endif %}{% endfor %}</td>{% endif %}
<td class='string'>{{ treatment.start_date|default_if_none:"-" }}{% if treatment.end_date %}/{{ treatment.end_date|default_if_none:"-" }}{% endif %}</td>
</tr>
{% endfor %}