From 8b7c617c7ac7f752646bd48f39da97dcfbaaaab2 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 10 Jun 2020 18:47:17 +0200 Subject: Documents: better form - improve select2 widget to manage new --- ishtar_common/views.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'ishtar_common/views.py') diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 3e5ef48cf..64219ba66 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -1928,6 +1928,9 @@ class OrganizationPersonEdit(LoginRequiredMixin, UpdateView): # documents +new_document_tag = new_qa_item(models.DocumentTag, forms.AddDocumentTagForm) +autocomplete_documenttag = get_autocomplete_generic(models.DocumentTag) + show_document = show_item(models.Document, 'document') get_document = get_item(models.Document, 'get_document', 'document', search_form=forms.DocumentSelect) @@ -1956,7 +1959,7 @@ class DocumentFormMixin(IshtarMixin, LoginRequiredMixin): class DocumentCreateView(DocumentFormMixin, CreateView): - page_name = _(u"Document creation") + page_name = _("Document creation") def get_form_kwargs(self): kwargs = super(DocumentCreateView, self).get_form_kwargs() @@ -1998,12 +2001,7 @@ class DocumentSelectView(IshtarMixin, LoginRequiredMixin, class DocumentEditView(DocumentFormMixin, UpdateView): - page_name = _(u"Document modification") - - def get_context_data(self, **kwargs): - data = super(DocumentEditView, self).get_context_data(**kwargs) - data["extra_form_modals"] = ['author', 'person', 'organization'] - return data + page_name = _("Document modification") def get_form_kwargs(self): kwargs = super(DocumentEditView, self).get_form_kwargs() @@ -2034,6 +2032,7 @@ class DocumentEditView(DocumentFormMixin, UpdateView): if related_item.main_image == document: initial[key] = True kwargs['initial'] = initial + kwargs["user"] = self.request.user return kwargs -- cgit v1.2.3