summaryrefslogtreecommitdiff
path: root/archaeological_files/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_files/forms.py
parent88757c7fc528a83c0bb3f317d2c9961b65ea3ec6 (diff)
downloadIshtar-294f9e1102d25d53ed45d0b850286eeb986e5963.tar.bz2
Ishtar-294f9e1102d25d53ed45d0b850286eeb986e5963.zip
Administrativ act: search by departments
Diffstat (limited to 'archaeological_files/forms.py')
-rw-r--r--archaeological_files/forms.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py
index 75a794fca..a8dd99135 100644
--- a/archaeological_files/forms.py
+++ b/archaeological_files/forms.py
@@ -380,6 +380,9 @@ class AdministrativeActFileModifySelect(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=[])
def __init__(self, *args, **kwargs):
super(AdministrativeActFileModifySelect, self).__init__(*args,
@@ -388,6 +391,11 @@ class AdministrativeActFileModifySelect(TableSelect):
dct={'intented_to': 'F'})
self.fields['act_type'].help_text = ActType.get_help(
dct={'intented_to': 'F'})
+ 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 AdministrativeActFileSelect(TableSelect):
@@ -431,6 +439,9 @@ class AdministrativeActFileSelect(TableSelect):
validators=[valid_id(Person)])
associated_file__permit_reference = forms.CharField(
max_length=200, label=_("Permit reference"))
+ 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(
@@ -446,6 +457,11 @@ class AdministrativeActFileSelect(TableSelect):
dct={'intented_to': 'F'})
self.fields['act_type'].help_text = ActType.get_help(
dct={'intented_to': 'F'})
+ 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 AdministrativeActFileFormSelection(AdministrativeActOpeFormSelection):