summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ishtar_common/models.py19
-rw-r--r--ishtar_common/templates/ishtar/sheet_source.html2
-rw-r--r--ishtar_common/templatetags/link_to_window.py9
3 files changed, 27 insertions, 3 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index b0625e25c..932beaf98 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -2358,6 +2358,21 @@ class Person(Address, Merge, OwnPerms, ValueGetter):
values.append(attached_to)
return u" ".join(values)
+ def fancy_str(self):
+ values = ["<strong>"]
+ values += [unicode(getattr(self, attr)) for attr in ('surname', 'name')
+ if getattr(self, attr)]
+ if not values and self.raw_name:
+ values += [self.raw_name]
+ values += ["</strong>"]
+
+ if self.attached_to:
+ attached_to = unicode(self.attached_to)
+ if values:
+ values.append(u'-')
+ values.append(attached_to)
+ return u" ".join(values)
+
def get_values(self, prefix=''):
values = super(Person, self).get_values(prefix=prefix)
if not self.attached_to:
@@ -2547,6 +2562,10 @@ class Author(models.Model):
return unicode(self.person) + settings.JOINT + \
unicode(self.author_type)
+ def fancy_str(self):
+ return self.person.fancy_str() + settings.JOINT + \
+ unicode(self.author_type)
+
def related_sources(self):
return list(self.treatmentsource_related.all()) + \
list(self.operationsource_related.all()) + \
diff --git a/ishtar_common/templates/ishtar/sheet_source.html b/ishtar_common/templates/ishtar/sheet_source.html
index 08406286d..1c00b684e 100644
--- a/ishtar_common/templates/ishtar/sheet_source.html
+++ b/ishtar_common/templates/ishtar/sheet_source.html
@@ -19,7 +19,6 @@
{% field_li "Format type" item.format_type %}
{% field_li "Scale" item.scale %}
{% field_li_url "Web link" item.associated_url %}
-{% field_li "Authors" item.authors|add_links:'person' %}
{% field_li "Item number" item.item_number %}
{% field_li "Ref." item.reference %}
{% field_li "Internal ref." item.internal_reference %}
@@ -31,6 +30,7 @@
{% field_li "Comment" item.comment %}
{% field_li "Additional information" item.additional_information %}
</ul>
+{% field "Authors" item.authors|add_links:'person' %}
{% endblock %}
{% endblock %}
diff --git a/ishtar_common/templatetags/link_to_window.py b/ishtar_common/templatetags/link_to_window.py
index 93924b77a..0417da53f 100644
--- a/ishtar_common/templatetags/link_to_window.py
+++ b/ishtar_common/templatetags/link_to_window.py
@@ -47,8 +47,13 @@ def add_links(items, extra_attr=''):
item_lnk = item
if extra_attr:
item_lnk = getattr(item, extra_attr)
- html.append(u"{} {}".format(unicode(item), link_to_window(item_lnk)))
- return mark_safe(u" ; ".join(html))
+ lbl = ''
+ if hasattr(item, 'fancy_str'):
+ lbl = item.fancy_str()
+ else:
+ lbl = unicode(item)
+ html.append(u"{} {}".format(lbl, link_to_window(item_lnk)))
+ return mark_safe(u"<br/>".join(sorted(html)))
@register.inclusion_tag('ishtar/blocks/modify_toolbar.html',