diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-01-28 16:50:07 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-01-28 16:50:07 +0100 |
commit | c31e7d69af0ed9a223ff0319d9d004549e500f4a (patch) | |
tree | 9b9669a93158fd946be8d4f655a81bf4f5339951 /archaeological_files/forms.py | |
parent | 9f9afced817b6f663d4edc8856556b55b2e294b6 (diff) | |
download | Ishtar-c31e7d69af0ed9a223ff0319d9d004549e500f4a.tar.bz2 Ishtar-c31e7d69af0ed9a223ff0319d9d004549e500f4a.zip |
Search by department for archaeological files
Diffstat (limited to 'archaeological_files/forms.py')
-rw-r--r-- | archaeological_files/forms.py | 7 |
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() |