diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-04-03 12:49:07 +0200 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2023-04-03 12:50:03 +0200 | 
| commit | eeeef30f64202395144da33e900515bd3663d6db (patch) | |
| tree | d99d373cc7f268d9cc3beb678767bc2a9ca2ad03 /ishtar_common | |
| parent | 08ae12f855d173c4220608d44bb7162cec3e2770 (diff) | |
| download | Ishtar-eeeef30f64202395144da33e900515bd3663d6db.tar.bz2 Ishtar-eeeef30f64202395144da33e900515bd3663d6db.zip | |
Sheets: fix history view with associated geo
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_geographic.html | 10 | ||||
| -rw-r--r-- | ishtar_common/views_item.py | 1 | 
2 files changed, 6 insertions, 5 deletions
| 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 %}  <table id='{{window_id}}-geographic-data' class="table table-striped">      <tr> -        {% if permission_change_geo %}<th> </th>{% endif %} +        {% if not IS_HISTORY and permission_change_geo %}<th> </th>{% endif %}          <th>{% trans "Main" %}</th>          <th>{% trans "Data type" %}</th>          <th>{% trans "Source" %}</th> @@ -11,11 +11,11 @@          <th>{% trans "Origin" %}</th>          <th>{% trans "Provider" %}</th>          <th>{% trans "Comment" %}</th> -        {% if permission_change_geo %}<th> </th>{% endif %} +        {% if not IS_HISTORY and permission_change_geo %}<th> </th>{% endif %}      </tr>  {% for geo in geo_item.geodata.all %}      <tr> -        {% if permission_change_geo %}<td> +        {% if not IS_HISTORY and permission_change_geo %}<td>          <a title="{% trans 'Edit' %}" href="{% url 'edit-geo' geo.pk %}{% if search_url %}?back_url={{search_url}}%3Fopen_item={{geo_item.pk}}{% endif %}">{% if geo|can_edit_item:request %}<i class="fa fa-pencil"></i></a>{% else %}–{% endif %}          </td>{% endif %}          <td>{% if geo.id == geo_item.main_geodata_id %}<i class="fa fa-check-circle text-success" aria-hidden="true"></i>{% else %}–{% endif %}</td> @@ -26,7 +26,7 @@          <td>{% if geo.origin %}{{ geo.origin }}{% else %}-{% endif %}</td>          <td>{% if geo.provider %}{{ geo.provider }}{% else %}-{% endif %}</td>          <td>{% if geo.comment %}{{ geo.comment }}{% else %}-{% endif %}</td> -        {% if permission_change_geo and output != "ODT" and output != "PDF" %}<td> +        {% if not IS_HISTORY and permission_change_geo and output != "ODT" and output != "PDF" %}<td>              <a title="{% trans 'Delete' %}"                 href="{% url 'delete-geo' geo.pk %}{% if search_url %}?back_url={{search_url}}%3Fopen_item={{geo_item.pk}}{% endif %}">                  {% if geo|can_edit_item:request %}<i class="fa fa-trash text-danger"></i></a>{% else %}–{% endif %} @@ -34,7 +34,7 @@      </tr>  {% endfor %}  </table> -{% if permission_change_geo and output != "ODT" and output != "PDF" %} +{% if not IS_HISTORY and permission_change_geo and output != "ODT" and output != "PDF" %}  <div class="text-center">      <a class="btn btn-success" href="{% url 'create-pre-geo' item.app_label item.model_name item.pk %}{% if search_url %}?back_url={{search_url}}%3Fopen_item={{geo_item.pk}}{% endif %}"><i class="fa fa-plus"></i>  {% trans "geo item" %}</a>  </div> 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 | 
