summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2023-01-20 16:22:13 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2023-01-20 16:22:13 +0100
commitac556eb088952c971775a53bc8ac6023dccf459b (patch)
tree33d537b7adc7c142985f2f265436d8a31a44139c
parent1b4d8b39ba06bb4b8fecc1fdd9ada9cd318e2ba9 (diff)
downloadIshtar-ac556eb088952c971775a53bc8ac6023dccf459b.tar.bz2
Ishtar-ac556eb088952c971775a53bc8ac6023dccf459b.zip
Sheet find container - fix date and float format
-rw-r--r--archaeological_finds/templates/ishtar/sheet_basefind.html10
-rw-r--r--archaeological_warehouse/models.py4
-rw-r--r--archaeological_warehouse/templates/ishtar/sheet_container.html11
3 files changed, 16 insertions, 9 deletions
diff --git a/archaeological_finds/templates/ishtar/sheet_basefind.html b/archaeological_finds/templates/ishtar/sheet_basefind.html
index f3b200fe4..85987c320 100644
--- a/archaeological_finds/templates/ishtar/sheet_basefind.html
+++ b/archaeological_finds/templates/ishtar/sheet_basefind.html
@@ -21,18 +21,22 @@
{% field_flex "Parcel" base_find.context_record.parcel '' '' first %}
{# START discovery dates #}
+ {% with base_find.discovery_date|date:"SHORT_DATE_FORMAT" as discovery_date %}
{% if not base_find.discovery_date_taq %}
{% trans "Discovery date" as discovery_date_label %}
- {% field_flex discovery_date_label base_find.discovery_date '' '' first %}
+ {% field_flex discovery_date_label discovery_date '' '' first %}
{% elif base_find.discovery_date.year == base_find.discovery_date_taq.year and base_find.discovery_date_taq|date:"d-m" == "31-12" and base_find.discovery_date|date:"d-m" == "01-01" %}
{% trans "Discovery year" as discovery_year_label %}
{% field_flex discovery_year_label base_find.discovery_date.year '' '' first %}
{% else %}
{% trans "Discovery date (exact or beginning)" as discovery_tpq_label %}
- {% field_flex discovery_tpq_label base_find.discovery_date '' '' first %}
+ {% field_flex discovery_tpq_label discovery_date '' '' first %}
{% trans "Discovery date (end)" as discovery_taq_label %}
- {% field_flex discovery_taq_label base_find.discovery_date_taq '' '' first %}
+ {% with base_find.discovery_date_taq|date:"SHORT_DATE_FORMAT" as discovery_date_taq %}
+ {% field_flex discovery_taq_label discovery_date_taq '' '' first %}
+ {% endwith %}
{% endif %}
+ {% endwith %}
{# END discovery dates #}
{% field_flex "Excavation ID" base_find.excavation_id '' '' first %}
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py
index 5d96e6863..4fcb1b1d7 100644
--- a/archaeological_warehouse/models.py
+++ b/archaeological_warehouse/models.py
@@ -1285,12 +1285,12 @@ class Container(
@property
def calculated_weight_kg(self):
if self.calculated_weight:
- return self.calculated_weight / 1000
+ return self.calculated_weight / 1000.0
@property
def weight_kg(self):
if self.weight:
- return self.weight / 1000
+ return self.weight / 1000.0
def natural_key(self):
return (self.uuid,)
diff --git a/archaeological_warehouse/templates/ishtar/sheet_container.html b/archaeological_warehouse/templates/ishtar/sheet_container.html
index 6c0edc3dc..4cea9b732 100644
--- a/archaeological_warehouse/templates/ishtar/sheet_container.html
+++ b/archaeological_warehouse/templates/ishtar/sheet_container.html
@@ -133,13 +133,16 @@
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i> &nbsp;
{% trans "Calculated weight and measured weight are too different (over 10%)." %}
</div>
- {% field_flex weight_kg_trans item.weight_kg %}
- {% field_flex calculated_weight_kg_trans item.calculated_weight_kg %}
+ {% if item.weight %}
+ {% field_flex weight_kg_trans item.weight_kg|floatformat:"-3" %}
+ {% endif %}{% if item.calculated_weight %}
+ {% field_flex calculated_weight_kg_trans item.calculated_weight_kg|floatformat:"-3" %}
+ {% endif %}
{% else %}
{% if item.weight %}
- {% field_flex weight_kg_trans item.weight_kg %}
+ {% field_flex weight_kg_trans item.weight_kg|floatformat:"-3" %}
{% elif item.calculated_weight %}
- {% field_flex calculated_weight_kg_trans item.calculated_weight_kg %}
+ {% field_flex calculated_weight_kg_trans item.calculated_weight_kg|floatformat:"-3" %}
{% endif %}
{% endif %}{% endwith %}
{% include "ishtar/blocks/sheet_creation_section.html" %}