diff options
Diffstat (limited to 'archaeological_files/forms.py')
-rw-r--r-- | archaeological_files/forms.py | 16 |
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): |