diff options
-rw-r--r-- | archaeological_finds/templates/ishtar/sheet_find.html | 25 | ||||
-rw-r--r-- | archaeological_operations/templates/ishtar/sheet_operation.html | 2 | ||||
-rw-r--r-- | ishtar_common/models.py | 7 |
3 files changed, 32 insertions, 2 deletions
diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html index 57ed7e662..33c884db3 100644 --- a/archaeological_finds/templates/ishtar/sheet_find.html +++ b/archaeological_finds/templates/ishtar/sheet_find.html @@ -32,7 +32,18 @@ {% field_li "Free-ID" item.label %} {% field_li "Previous ID" item.previous_id %} {% field_li "Description" item.description %} -{% field_li "Created by" item.history_creator.ishtaruser.full_label %} +{% with item.history_creation_date|date:"SHORT_DATETIME_FORMAT" as creation_date %} +{% with item.history_creator.ishtaruser.full_label|add:"<br/><i>"|add:creation_date|add:"</i>" as creator %} +{% field_li "Created by" creator|safe %} +{% endwith %} +{% endwith %} +{% if item.history_creation_date != item.last_edition_date %} +{% with item.last_edition_date|date:"SHORT_DATETIME_FORMAT" as edition_date %} +{% with item.history_modifier.ishtaruser.full_label|add:"<br/><i>"|add:edition_date|add:"</i>" as modifier %} +{% field_li "Last modified by" modifier|safe %} +{% endwith %} +{% endwith %} +{% endif %} {% field_li "Administrative index" item.administrative_index %} {% field_li_multiple "Material types" item.material_types %} {% field_li "Dating" item.dating %} @@ -123,6 +134,18 @@ <ul class='form-flex'> {% field_li "Complete ID" base_find.complete_id %} {% field_li "Short ID" base_find.short_id %} +{% with item.history_creation_date|date:"SHORT_DATETIME_FORMAT" as creation_date %} +{% with item.history_creator.ishtaruser.full_label|add:"<br/><i>"|add:creation_date|add:"</i>" as creator %} +{% field_li "Created by" creator|safe %} +{% endwith %} +{% endwith %} +{% if item.history_creation_date != item.last_edition_date %} +{% with item.last_edition_date|date:"SHORT_DATETIME_FORMAT" as edition_date %} +{% with item.history_modifier.ishtaruser.full_label|add:"<br/><i>"|add:edition_date|add:"</i>" as modifier %} +{% field_li "Last modified by" modifier|safe %} +{% endwith %} +{% endwith %} +{% endif %} {% if base_find.IS_ISOLATED_DICT %} {% field_li "Batch/object" base_find.batch|from_dict:base_find.IS_ISOLATED_DICT %} {% endif %} diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index 6d272ee7c..a8d46252d 100644 --- a/archaeological_operations/templates/ishtar/sheet_operation.html +++ b/archaeological_operations/templates/ishtar/sheet_operation.html @@ -37,7 +37,7 @@ {% if item.code_patriarche %}<p><label>{%trans "Patriarche OA code:"%}</label> <span class='value'>OA{{ item.code_patriarche }}</span></p>{%else%} <p class='alert'><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> {%trans "Patriarche OA code not yet recorded!"%}</p>{%endif%} -<p><label>{%trans "Edition date:"%}</label> <span class='value'>{% if item.history_date %}{{ item.history_date }}{% else %}{{ item.history.all.0.history_date }}{% endif %}</span></p> <!-- date = now --> +<p><label>{%trans "Last modification date:"%}</label> <span class='value'>{% if item.history_date %}{{ item.history_date }}{% else %}{{ item.history.all.0.history_date }}{% endif %}</span></p> <!-- date = now --> <p><label>{%trans "Created by:"%}</label> <span class='value'>{{ item.history_creator.ishtaruser.full_label }}</span></p> {% if item.start_date %}<p><label>{%trans "Begining date:"%}</label> <span class='value'>{{ item.start_date }}</span></p> diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 02786a8e4..97e578f01 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -686,6 +686,13 @@ class BaseHistorizedItem(Imported): except IndexError: return + @property + def history_creation_date(self): + try: + return self.history.order_by('history_date').all()[0].history_date + except IndexError: + return + def rollback(self, date): """ Rollback to a previous state |