From 26fd95c723cec410e179362f2c86ea1e7b527e3d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 12 May 2014 22:57:10 +0200 Subject: Fix created by fields on sheets (refs #1590) --- ishtar_common/models.py | 14 +++----------- ishtar_common/templates/ishtar/sheet_organization.html | 1 + ishtar_common/templates/ishtar/sheet_person.html | 1 + 3 files changed, 5 insertions(+), 11 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 4e05a115f..1aaaf933a 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -453,17 +453,6 @@ 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 @@ -882,6 +871,9 @@ class IshtarUser(User): def has_right(self, right_name): return self.person.has_right(right_name) + def full_label(self): + return self.person.full_label() + class AuthorType(GeneralType): class Meta: verbose_name = _(u"Author type") diff --git a/ishtar_common/templates/ishtar/sheet_organization.html b/ishtar_common/templates/ishtar/sheet_organization.html index e58d84887..c5f01b96a 100644 --- a/ishtar_common/templates/ishtar/sheet_organization.html +++ b/ishtar_common/templates/ishtar/sheet_organization.html @@ -10,6 +10,7 @@
{%trans "Export as:"%} {%trans "OpenOffice.org file"%}, {%trans "PDF file"%}

{{item.name}}

+

{{ item.history_creator.ishtaruser.full_label }}

{% if item.address %}

{{item.address}}

{% endif %} {% if item.address_complement %}

{{item.address_complement}}

{% endif %} {% if item.postal_code %}

{{item.postal_code}}

{% endif %} diff --git a/ishtar_common/templates/ishtar/sheet_person.html b/ishtar_common/templates/ishtar/sheet_person.html index 1fc31ac23..b6bf99d56 100644 --- a/ishtar_common/templates/ishtar/sheet_person.html +++ b/ishtar_common/templates/ishtar/sheet_person.html @@ -11,6 +11,7 @@

{{item.name}}

{{item.surname}}

+

{{ item.history_creator.ishtaruser.full_label }}

{% if item.email %}

{{item.email}}

{% endif %}

{{item.person_types_list}}

{% if item.address %}

{{item.address}}

{% endif %} -- cgit v1.2.3