summaryrefslogtreecommitdiff
path: root/archaeological_operations/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-12-01 19:18:45 +0100
committerÉtienne Loks <etienne.loks@proxience.com>2015-12-01 19:18:45 +0100
commit294f9e1102d25d53ed45d0b850286eeb986e5963 (patch)
treef7a7b2e7f9a365e920e576e8661364e61d70061e /archaeological_operations/forms.py
parent88757c7fc528a83c0bb3f317d2c9961b65ea3ec6 (diff)
downloadIshtar-294f9e1102d25d53ed45d0b850286eeb986e5963.tar.bz2
Ishtar-294f9e1102d25d53ed45d0b850286eeb986e5963.zip
Administrativ act: search by departments
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r--archaeological_operations/forms.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index 6640ae7e3..06c6585d8 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -986,6 +986,9 @@ class AdministrativeActOpeSelect(TableSelect):
max_length=15)
act_type = forms.ChoiceField(label=_("Act type"), choices=[])
operation__towns = get_town_field()
+ if settings.ISHTAR_DPTS:
+ operation__towns__numero_insee__startswith = forms.ChoiceField(
+ label=_(u"Department"), choices=[])
history_creator = forms.IntegerField(
label=_(u"Created by"),
widget=widgets.JQueryAutoComplete(
@@ -999,6 +1002,12 @@ class AdministrativeActOpeSelect(TableSelect):
dct={'intented_to': 'O'})
self.fields['act_type'].help_text = models.ActType.get_help(
dct={'intented_to': 'O'})
+ if settings.ISHTAR_DPTS:
+ k = 'operation__towns__numero_insee__startswith'
+ self.fields[k].choices = [
+ ('', '--')] + [(str(dpt), str(dpt))
+ for dpt in settings.ISHTAR_DPTS]
+
class AdministrativeActOpeFormSelection(forms.Form):