summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2014-01-13 11:05:15 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2014-01-13 11:05:15 +0100
commit61cc73ab79d433ee716b4bb7fbe834c3e9379b8f (patch)
treedba40d381f2786606febe74fa6150c94e9526c81
parent08714316474e41d7c88396e33650e785e284e7b2 (diff)
downloadIshtar-61cc73ab79d433ee716b4bb7fbe834c3e9379b8f.tar.bz2
Ishtar-61cc73ab79d433ee716b4bb7fbe834c3e9379b8f.zip
Add created by to record cart (refs #1590)
-rw-r--r--archaeological_context_records/templates/ishtar/sheet_contextrecord.html2
-rw-r--r--archaeological_files/templates/ishtar/sheet_file.html1
-rw-r--r--archaeological_operations/templates/ishtar/sheet_administrativeact.html2
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operation.html1
-rw-r--r--ishtar_common/models.py19
5 files changed, 22 insertions, 3 deletions
diff --git a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
index 06528c4d2..ee1719eda 100644
--- a/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
+++ b/archaeological_context_records/templates/ishtar/sheet_contextrecord.html
@@ -29,6 +29,8 @@
<p><label>{%trans "Temporary ID:"%}</label>
{%endif%}
<span class='value'>{{item.full_label}}</span></p>
+<p><label>{%trans "Creation date:"%}</label> <span class='value'>{{ item.creation_date }}</span></p>
+<p><label>{%trans "Created by:"%}</label> <span class='value'>{{ item.created_by.full_label }}</span></p>
{%if item.unit %}
<p><label>{% trans "Type:" %}</label> <span class='value'>{{ item.unit }}</span></p>
{%endif%}
diff --git a/archaeological_files/templates/ishtar/sheet_file.html b/archaeological_files/templates/ishtar/sheet_file.html
index e8ddca99a..40ac707d6 100644
--- a/archaeological_files/templates/ishtar/sheet_file.html
+++ b/archaeological_files/templates/ishtar/sheet_file.html
@@ -31,6 +31,7 @@
<p><label>{%trans "Edition date:"%}</label> <span class='value'>{{ item.history_date }}</span></p> <!-- date = now -->
{% if item.reception_date %}<p><label>{%trans "Reception date:"%}</label> <span class='value'>{{ item.reception_date }}</span></p>{% endif %}
<p><label>{%trans "Creation date:"%}</label> <span class='value'>{{ item.creation_date }}</span></p>
+<p><label>{%trans "Created by:"%}</label> <span class='value'>{{ item.created_by.full_label }}</span></p>
{% comment %}
{% if item.deadline_date and not item.acts %}
<p><label>{%trans "Deadline:"%}</label> <span class='value'>{% item.deadline_date %}</span></p> <!-- calculated deadline for some preventive files , see saisine_type, not displayed if an act as been send -->
diff --git a/archaeological_operations/templates/ishtar/sheet_administrativeact.html b/archaeological_operations/templates/ishtar/sheet_administrativeact.html
index e44dc4aea..da80f6747 100644
--- a/archaeological_operations/templates/ishtar/sheet_administrativeact.html
+++ b/archaeological_operations/templates/ishtar/sheet_administrativeact.html
@@ -16,11 +16,11 @@
<p><label>{%trans "In charge:"%}</label> <span class='value'>{{ item.in_charge.full_label }}</span></p>
{% if item.operator %}<p><label>{%trans "Archaeological preventive operator:"%}</label> <span class='value'>{{ item.operator }}</span></p>{% endif %}
-{% comment %}<p><label>{%trans "Creation date:"%}</label> <span class='value'>{{ item.creation_date }}</span></p>{% endcomment %}
{% if item.associated_file %}<p><label>{%trans "Associated file:"%}</label> <span class='value'><a href='#' onclick='load_window("{% url show-file item.associated_file.pk ''%}")'>{{ item.associated_file }}</a></span></p>{% endif %} <!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related file -->
{% if item.operation %}<p><label>{%trans "Associated operation:"%}</label> <span class='value'><a href='#' onclick='load_window("{% url show-operation item.operation.pk ''%}")'>{{ item.operation }}</a></span></p>{% endif %} <!-- Displayed as Year/index/Commune/Common_name This should be a link to the file sheet of the related operation -->
{% if item.operation %}{% if item.operation.surface %}<p><label>{%trans "Surface:"%}</label> <span class='value'>{{ item.operation.surface }} m<sup>2</sup> ({{ item.operation.surface_ha }} ha)</span></p>{%endif%} {% endif %}
+<p><label>{%trans "Created by:"%}</label> <span class='value'>{{ item.created_by.full_label }}</span></p>
{%comment%}{% if item.general_contractor.attached_to %}<p><label>{%trans "General contractor organisation:"%}</label> <span class='value'>{{ item.general_contractor.attached_to }}</span></p>{% endif %} <!-- Contractor's organisation displayed as concat of Name/Adress/postal_code/city -->
{% if item.general_contractor %}<p><label>{%trans "General contractor:"%}</label> <span class='value'>{{ item.general_contractor.full_label }}</span></p>{% endif %}
{%endcomment%}
diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html
index e1846c8e2..9d9b845e3 100644
--- a/archaeological_operations/templates/ishtar/sheet_operation.html
+++ b/archaeological_operations/templates/ishtar/sheet_operation.html
@@ -34,6 +34,7 @@
<p class='alert'>{%trans "Patriarche OA code not yet recorded!"%}</p>{%endif%}
<p><label>{%trans "Edition date:"%}</label> <span class='value'>{{ item.history.all.0.history_date }}</span></p> <!-- date = now -->
+<p><label>{%trans "Created by:"%}</label> <span class='value'>{{ item.created_by.full_label }}</span></p>
{% if item.start_date %}<p><label>{%trans "Begining date:"%}</label> <span class='value'>{{ item.start_date }}</span></p>
<p><label>{%trans "Excavation end date:"%}</label> <span class='value'>{{ item.excavation_end_date|default:"-" }}</span></p>
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index b7553d911..811e2e63b 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -440,6 +440,17 @@ class BaseHistorizedItem(models.Model):
except IndexError:
return
+ @property
+ def created_by(self):
+ q = self.history.order_by('history_date')
+ if not q.count():
+ return
+ try:
+ modifier = IshtarUser.objects.get(pk=q.all()[0].history_modifier_id)
+ return modifier.person
+ except IshtarUser.DoesNotExist:
+ return
+
def rollback(self, date):
"""
Rollback to a previous state
@@ -767,8 +778,10 @@ class Person(Address, OwnPerms, ValueGetter) :
def __unicode__(self):
values = [unicode(getattr(self, attr))
- for attr in ('surname', 'name', 'attached_to')
+ for attr in ('surname', 'name')
if getattr(self, attr)]
+ if self.attached_to:
+ values.append(u"- " + unicode(self.attached_to))
return u" ".join(values)
def get_values(self, prefix=''):
@@ -806,8 +819,10 @@ class Person(Address, OwnPerms, ValueGetter) :
if self.title:
values = [unicode(_(self.title))]
values += [unicode(getattr(self, attr))
- for attr in ('surname', 'name', 'attached_to')
+ for attr in ('surname', 'name')
if getattr(self, attr)]
+ if self.attached_to:
+ values.append(u"- " + unicode(self.attached_to))
return u" ".join(values)
@property