summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archaeological_files/forms.py6
-rw-r--r--archaeological_operations/forms.py10
-rw-r--r--archaeological_operations/views.py2
3 files changed, 12 insertions, 6 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py
index 8c360e364..9d317db1f 100644
--- a/archaeological_files/forms.py
+++ b/archaeological_files/forms.py
@@ -396,8 +396,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 +463,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):
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index 294e3163c..d696f44dc 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -418,6 +418,9 @@ class OperationSelect(TableSelect):
if settings.COUNTRY == 'fr':
code_patriarche = forms.IntegerField(label="Code PATRIARCHE")
towns = get_town_field()
+ if settings.ISHTAR_DPTS:
+ towns__numero_insee__startswith = forms.ChoiceField(
+ label="Department", choices=[])
operation_type = forms.ChoiceField(label=_(u"Operation type"),
choices=[])
scientist = forms.IntegerField(
@@ -484,6 +487,10 @@ class OperationSelect(TableSelect):
self.fields['periods'].help_text = models.Period.get_help()
self.fields['record_quality'].choices = \
[('', '--')] + list(models.QUALITY)
+ if settings.ISHTAR_DPTS:
+ k = 'towns__numero_insee__startswith'
+ self.fields[k].choices = [
+ ('', '--')] + list(settings.ISHTAR_DPTS)
self.fields['relation_types'].choices = models.RelationType.get_types(
empty_first=False)
@@ -1076,8 +1083,7 @@ class AdministrativeActOpeSelect(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 AdministrativeActOpeFormSelection(forms.Form):
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py
index 8b8d820a3..e37a615eb 100644
--- a/archaeological_operations/views.py
+++ b/archaeological_operations/views.py
@@ -139,6 +139,8 @@ get_operation = get_item(
'start_after': 'start_date__gte',
'end_before': 'excavation_end_date__lte',
'end_after': 'excavation_end_date__gte',
+ 'towns__numero_insee__startswith':
+ 'towns__numero_insee__startswith',
'parcel_0': ('parcels__section',
'associated_file__parcels__section'),
'parcel_1': (