From 8276cfe397dc715d1710a27a29f617565daffb90 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 9 Mar 2020 13:26:04 +0100 Subject: Quick actions - tables - site: add bulk update form (towns field) --- archaeological_operations/forms.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'archaeological_operations/forms.py') diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index f8cc19165..9a3335df5 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -1983,3 +1983,21 @@ class QAArchaeologicalSiteDuplicateForm(IshtarForm): for k in ("name", "reference"): data[k] = self.cleaned_data.get("qa_" + k, None) return self.site.duplicate(self.user, data=data) + + +class QAArchaeologicalSiteFormMulti(QAForm): + form_admin_name = _("Archaeological files - Quick action - Modify") + form_slug = "archaeological_site-quickaction-modify" + associated_models = { + 'qa_towns': Town, + } + + MULTI = True + qa_towns = get_town_field(required=False) + + def _get_qa_towns(self, value): + try: + value = Town.objects.get(pk=value).cached_label + except Town.DoesNotExist: + return "" + return value -- cgit v1.2.3