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.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py
index 9d317db1f..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()