summaryrefslogtreecommitdiff
path: root/ishtar_common/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/views.py')
-rw-r--r--ishtar_common/views.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index 704894d52..ceb8db200 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -1923,7 +1923,7 @@ display_document = display_item(models.Document)
document_search_wizard = wizards.DocumentSearch.as_view(
[('selec-document_search', forms.DocumentFormSelection)],
- label=_(u"Document: search"),
+ label=_("Document: search"),
url_name='search-document',
)
@@ -2016,12 +2016,21 @@ class DocumentEditView(DocumentFormMixin, UpdateView):
for related_item in getattr(document, k).all():
key = "{}_{}_main_image".format(k, related_item.pk)
kwargs["main_items_fields"][k].append(
- (key, u"{} - {}".format(
- _(u"Main image for"), related_item)))
+ (key, "{} - {}".format(
+ _("Main image for"), related_item)))
if related_item.main_image == document:
initial[key] = True
kwargs['initial'] = initial
kwargs["user"] = self.request.user
+ self.document = document
+ return kwargs
+
+ def get_context_data(self, **kwargs):
+ kwargs = super(DocumentEditView, self).get_context_data(**kwargs)
+ rel = self.document.cache_related_label
+ if len(rel) == 1000: # truncated
+ rel += " (...)"
+ kwargs["item_related_label"] = rel
return kwargs