summaryrefslogtreecommitdiff
path: root/ishtar_common/forms_common.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2020-03-06 16:28:48 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2020-03-06 16:30:49 +0100
commitfbfcb59984c40f136ebd871041f0e3963f2374e4 (patch)
treec32ec909f00b34c565c440722af6fa5bf110b93e /ishtar_common/forms_common.py
parent5a325c41f7e87a167f3b7e26cb828852480f1af5 (diff)
downloadIshtar-fbfcb59984c40f136ebd871041f0e3963f2374e4.tar.bz2
Ishtar-fbfcb59984c40f136ebd871041f0e3963f2374e4.zip
Quick actions - tables - edit persons: add organization field
Diffstat (limited to 'ishtar_common/forms_common.py')
-rw-r--r--ishtar_common/forms_common.py17
1 files changed, 17 insertions, 0 deletions
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