summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-05-27 08:30:27 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-05-27 08:30:27 +0200
commitffd47c28bd7288a88745964a2031e61d991b0364 (patch)
tree3c74ff2345a4afa7699d91e09b68b4d168d778af
parentdfed6307d550c63eea210828cfc35eb299d37fdc (diff)
downloadIshtar-ffd47c28bd7288a88745964a2031e61d991b0364.tar.bz2
Ishtar-ffd47c28bd7288a88745964a2031e61d991b0364.zip
OA prefix: fix customize on sheet, form and save
-rw-r--r--CHANGES.md12
-rw-r--r--archaeological_context_records/models.py4
-rw-r--r--archaeological_finds/models_finds.py12
-rw-r--r--archaeological_operations/templates/ishtar/blocks/OAWidget.html6
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operation.html2
-rw-r--r--archaeological_operations/widgets.py4
6 files changed, 26 insertions, 14 deletions
diff --git a/CHANGES.md b/CHANGES.md
index 5fd7c4f74..f55affc2f 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,11 +1,21 @@
---
title: Ishtar changelog
-date: 2022-05-17
+date: 2022-05-27
---
Ishtar changelog
================
+v3.1.70 - 2022-05-27
+--------------------
+
+### Bug fix ###
+
+- Operation: fix find change when no OA prefix is set
+- Sheet operation: fix display when no 01 prefix is set
+- Operation form: fix OA prefix
+
+
v3.1.69 - 2022-05-23
--------------------
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index 870a10046..d143ddd09 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -914,8 +914,8 @@ class ContextRecord(
WHERE {where}
);
""".format(
- main_ope_prefix=profile.operation_prefix,
- ope_prefix=profile.default_operation_prefix,
+ main_ope_prefix=(profile.operation_prefix or ""),
+ ope_prefix=(profile.default_operation_prefix or ""),
join=settings.JOINT,
where=where,
)
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index 29edd7aba..2825faf02 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -592,10 +592,10 @@ class BaseFind(
ope = self.context_record.operation
c_id = []
if ope.code_patriarche:
- c_id.append(profile.operation_prefix + ope.code_patriarche)
+ c_id.append((profile.operation_prefix or "") + ope.code_patriarche)
elif ope.year and ope.operation_code:
c_id.append(
- profile.default_operation_prefix
+ (profile.default_operation_prefix or "")
+ str(ope.year or "")
+ "-"
+ str(ope.operation_code or "")
@@ -819,8 +819,8 @@ class BaseFind(
{filters}
);
""".format(
- main_ope_prefix=profile.operation_prefix,
- ope_prefix=profile.default_operation_prefix,
+ main_ope_prefix=(profile.operation_prefix or ""),
+ ope_prefix=(profile.default_operation_prefix or ""),
join=settings.JOINT,
filters=filters,
zeros=settings.ISHTAR_FINDS_INDEX_ZERO_LEN * "0",
@@ -2679,8 +2679,8 @@ class Find(
{filters}
);
""".format(
- main_ope_prefix=profile.operation_prefix,
- ope_prefix=profile.default_operation_prefix,
+ main_ope_prefix=(profile.operation_prefix or ""),
+ ope_prefix=(profile.default_operation_prefix or ""),
join=settings.JOINT,
filters=filters,
index=index,
diff --git a/archaeological_operations/templates/ishtar/blocks/OAWidget.html b/archaeological_operations/templates/ishtar/blocks/OAWidget.html
index 6f4c1af24..58744daa6 100644
--- a/archaeological_operations/templates/ishtar/blocks/OAWidget.html
+++ b/archaeological_operations/templates/ishtar/blocks/OAWidget.html
@@ -1,6 +1,6 @@
<div class="input-group">
- <div class="input-group-prepend">
- <div class="input-group-text">OA</div>
- </div>
+ {% if oa_prefix %}<div class="input-group-prepend">
+ <div class="input-group-text">{{oa_prefix}}</div>
+ </div>{% endif %}
<input class="form-control widget-oa" type="text"{{final_attrs|safe}}>
</div> \ No newline at end of file
diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html
index e3076d3e9..a7d0b7ecc 100644
--- a/archaeological_operations/templates/ishtar/sheet_operation.html
+++ b/archaeological_operations/templates/ishtar/sheet_operation.html
@@ -117,7 +117,7 @@
<div class="col main">
{% if item.year or item.operation_code %}
{{item.year|default:''}}-{{item.operation_code|default:''}}{% endif %}<br>
- {% if item.code_patriarche %}OA{{item.code_patriarche}}{% endif %}
+ {% if item.code_patriarche %}{% if PROFILE.operation_prefix %}{{PROFILE.operation_prefix}}{% endif %}{{item.code_patriarche}}{% endif %}
{% if item.complete_identifier %}<p class="window-refs"
title="{% trans 'Complete identifier' %}">
<strong>{{ item.complete_identifier }}</strong></p>{% endif %}
diff --git a/archaeological_operations/widgets.py b/archaeological_operations/widgets.py
index 1494d0c14..f2a2d3d66 100644
--- a/archaeological_operations/widgets.py
+++ b/archaeological_operations/widgets.py
@@ -22,7 +22,7 @@ from django.forms import widgets
from django.forms.utils import flatatt
from django.template import loader
from django.utils.safestring import mark_safe
-from ishtar_common.utils import ugettext_lazy as _
+from ishtar_common.utils import ugettext_lazy as _, get_current_profile
class ParcelWidget(widgets.MultiWidget):
@@ -67,10 +67,12 @@ class OAWidget(forms.TextInput):
if not value:
value = ""
final_attrs = flatatt(self.build_attrs(attrs, {"name": name, "value": value}))
+ oa_prefix = get_current_profile(force=False).operation_prefix or ""
dct = {
"final_attrs": final_attrs,
"id": attrs["id"],
"safe_id": attrs["id"].replace("-", "_"),
+ "oa_prefix": oa_prefix
}
t = loader.get_template("ishtar/blocks/OAWidget.html")
rendered = t.render(dct)