From c96d651ed4f9e752758eca4eb957a6d0e72d3a1d Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Thu, 28 Jan 2016 16:50:07 +0100 Subject: Search by department for archaeological files --- archaeological_files/forms.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'archaeological_files/forms.py') 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() -- cgit v1.2.3