From 5c2457815a333edb98ccfb91c7bbf59db1501ccd Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Sat, 14 Sep 2019 23:45:09 +0200 Subject: QA edit doc: add authors field --- ishtar_common/forms_common.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'ishtar_common/forms_common.py') diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 16c9dd52d..5eaa6c435 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -1409,6 +1409,7 @@ class QADocumentFormMulti(QAForm): base_models = ['qa_source_type'] associated_models = { 'qa_source_type': models.SourceType, + 'qa_authors': models.Author, } MULTI = True @@ -1418,11 +1419,22 @@ class QADocumentFormMulti(QAForm): qa_source_type = forms.ChoiceField( label=_(u"Source type"), required=False ) + qa_authors = widgets.ModelJQueryAutocompleteField( + model=models.Author, label=_(u"Author"), new=True, + long_widget=True, required=False) TYPES = [ FieldType('qa_source_type', models.SourceType), ] + def _get_qa_authors(self, value): + print(value) + try: + value = models.Author.objects.get(pk=value).cached_label + except models.Author.DoesNotExist: + return "" + return value + class QALockForm(forms.Form): action = forms.ChoiceField( -- cgit v1.2.3