summaryrefslogtreecommitdiff
path: root/archaeological_operations/forms.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-01-28 16:32:14 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-01-28 16:32:14 +0100
commit43075d80e9cfde1b82e741862270601d756e43f7 (patch)
treeb1de8aaa740768efcf6b8b1b878da1fbd87a9baf /archaeological_operations/forms.py
parent22ff7b1077991ec86deec7659c223ca1ce3b7400 (diff)
downloadIshtar-43075d80e9cfde1b82e741862270601d756e43f7.tar.bz2
Ishtar-43075d80e9cfde1b82e741862270601d756e43f7.zip
Change management of default departments - department searches for acts
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r--archaeological_operations/forms.py10
1 files changed, 8 insertions, 2 deletions
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):