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
commit5020fb9c32b37c676f3231f0d9c40b4a782d6b5f (patch)
treef7a7b2e7f9a365e920e576e8661364e61d70061e /archaeological_files/forms.py
parentb3780b230773ed408bae65fc24a92f484e04b446 (diff)
downloadIshtar-5020fb9c32b37c676f3231f0d9c40b4a782d6b5f.tar.bz2
Ishtar-5020fb9c32b37c676f3231f0d9c40b4a782d6b5f.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):