From fbfcb59984c40f136ebd871041f0e3963f2374e4 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 6 Mar 2020 16:28:48 +0100 Subject: Quick actions - tables - edit persons: add organization field --- ishtar_common/forms_common.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ishtar_common/forms_common.py') diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 31eb5c7d2..2b3227f0a 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -575,20 +575,37 @@ class QAPersonFormMulti(QAForm): base_models = ['qa_title'] associated_models = { 'qa_title': models.TitleType, + 'qa_attached_to': models.Organization, } MULTI = True REPLACE_FIELDS = [ 'qa_title', + 'qa_attached_to' ] qa_title = forms.ChoiceField( label=_(u"Title"), required=False ) + qa_attached_to = forms.IntegerField( + label=_("Organization"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-organization'), + associated_model=models.Organization), + validators=[models.valid_id(models.Organization)], + required=False + ) TYPES = [ FieldType('qa_title', models.TitleType), ] + def _get_qa_attached_to(self, value): + try: + value = models.Organization.objects.get(pk=value).cached_label + except models.Organization.DoesNotExist: + return "" + return value + class PersonMergeFormSelection(ManualMerge, forms.Form): SEARCH_AND_SELECT = True -- cgit v1.2.3