summaryrefslogtreecommitdiff
path: root/archaeological_files/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_files/forms.py')
-rw-r--r--archaeological_files/forms.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py
index 8c360e364..42b3f6b6f 100644
--- a/archaeological_files/forms.py
+++ b/archaeological_files/forms.py
@@ -53,6 +53,9 @@ class FileSelect(TableSelect):
internal_reference = forms.CharField(max_length=200,
label=_("Other reference"))
towns = get_town_field()
+ if settings.ISHTAR_DPTS:
+ towns__numero_insee__startswith = forms.ChoiceField(
+ label="Department", choices=[])
name = forms.CharField(label=_(u"File name"), max_length=200)
file_type = forms.ChoiceField(label=_("File type"), choices=[])
saisine_type = forms.ChoiceField(label=_("Saisine type"), choices=[])
@@ -95,6 +98,10 @@ class FileSelect(TableSelect):
self.fields['saisine_type'].help_text = models.SaisineType.get_help()
self.fields['file_type'].choices = models.FileType.get_types()
self.fields['file_type'].help_text = models.FileType.get_help()
+ if settings.ISHTAR_DPTS:
+ k = 'towns__numero_insee__startswith'
+ self.fields[k].choices = [
+ ('', '--')] + list(settings.ISHTAR_DPTS)
def get_input_ids(self):
ids = super(FileSelect, self).get_input_ids()
@@ -396,8 +403,7 @@ class AdministrativeActFileModifySelect(TableSelect):
if settings.ISHTAR_DPTS:
k = 'operation__towns__numero_insee__startswith'
self.fields[k].choices = [
- ('', '--')] + [(str(dpt), str(dpt))
- for dpt in settings.ISHTAR_DPTS]
+ ('', '--')] + list(settings.ISHTAR_DPTS)
class AdministrativeActFileSelect(TableSelect):
@@ -464,8 +470,7 @@ class AdministrativeActFileSelect(TableSelect):
if settings.ISHTAR_DPTS:
k = 'operation__towns__numero_insee__startswith'
self.fields[k].choices = [
- ('', '--')] + [(str(dpt), str(dpt))
- for dpt in settings.ISHTAR_DPTS]
+ ('', '--')] + list(settings.ISHTAR_DPTS)
class AdministrativeActFileFormSelection(AdministrativeActOpeFormSelection):