diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-14 23:45:09 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-09-14 23:45:09 +0200 |
commit | 5c2457815a333edb98ccfb91c7bbf59db1501ccd (patch) | |
tree | 3f544246753ee3141f643010de153cef514132bc /ishtar_common/forms_common.py | |
parent | bb4a57dcfa0c107c414c39a70521cd557a8eb215 (diff) | |
download | Ishtar-5c2457815a333edb98ccfb91c7bbf59db1501ccd.tar.bz2 Ishtar-5c2457815a333edb98ccfb91c7bbf59db1501ccd.zip |
QA edit doc: add authors field
Diffstat (limited to 'ishtar_common/forms_common.py')
-rw-r--r-- | ishtar_common/forms_common.py | 12 |
1 files changed, 12 insertions, 0 deletions
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( |