From eeeef30f64202395144da33e900515bd3663d6db Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 3 Apr 2023 12:49:07 +0200 Subject: Sheets: fix history view with associated geo --- ishtar_common/templates/ishtar/blocks/sheet_geographic.html | 10 +++++----- ishtar_common/views_item.py | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/templates/ishtar/blocks/sheet_geographic.html b/ishtar_common/templates/ishtar/blocks/sheet_geographic.html index bad399ef2..e119cb3f0 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_geographic.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_geographic.html @@ -2,7 +2,7 @@ {% with search_url=item.get_search_url %} - {% if permission_change_geo %}{% endif %} + {% if not IS_HISTORY and permission_change_geo %}{% endif %} @@ -11,11 +11,11 @@ - {% if permission_change_geo %}{% endif %} + {% if not IS_HISTORY and permission_change_geo %}{% endif %} {% for geo in geo_item.geodata.all %} - {% if permission_change_geo %}{% endif %} @@ -26,7 +26,7 @@ - {% if permission_change_geo and output != "ODT" and output != "PDF" %} {% endfor %}
  {% trans "Main" %} {% trans "Data type" %} {% trans "Source" %}{% trans "Origin" %} {% trans "Provider" %} {% trans "Comment" %}  
+ {% if not IS_HISTORY and permission_change_geo %} {% if geo|can_edit_item:request %}{% else %}–{% endif %} {% if geo.id == geo_item.main_geodata_id %}{% else %}–{% endif %}{% if geo.origin %}{{ geo.origin }}{% else %}-{% endif %} {% if geo.provider %}{{ geo.provider }}{% else %}-{% endif %} {% if geo.comment %}{{ geo.comment }}{% else %}-{% endif %} + {% if not IS_HISTORY and permission_change_geo and output != "ODT" and output != "PDF" %} {% if geo|can_edit_item:request %}{% else %}–{% endif %} @@ -34,7 +34,7 @@
-{% if permission_change_geo and output != "ODT" and output != "PDF" %} +{% if not IS_HISTORY and permission_change_geo and output != "ODT" and output != "PDF" %}
 {% trans "geo item" %}
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index 9f90db4bf..f69b6883e 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -400,6 +400,7 @@ def show_item(model, name, extra_dct=None, model_for_perms=None): if date: try: date = datetime.datetime.strptime(date, "%Y-%m-%dT%H:%M:%S.%f") + dct["IS_HISTORY"] = True if item.get_last_history_date() != date: item = item.get_previous(date=date) assert item is not None -- cgit v1.2.3