summaryrefslogtreecommitdiff
path: root/archaeological_files_pdl
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-08-18 15:07:58 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2015-08-18 15:07:58 +0200
commitcd765b8a602db88488074aecae584727c487156f (patch)
treecd116e3bfaab2167f5f63ddc350eb55b678acf23 /archaeological_files_pdl
parent1d12ef323a174c2d39a1de6805b9baa981c405a5 (diff)
downloadIshtar-cd765b8a602db88488074aecae584727c487156f.tar.bz2
Ishtar-cd765b8a602db88488074aecae584727c487156f.zip
Archaeological files: associate many towns. PEP8 and formating.
Diffstat (limited to 'archaeological_files_pdl')
-rw-r--r--archaeological_files_pdl/forms.py17
-rw-r--r--archaeological_files_pdl/templates/ishtar/wizard/wizard_preventiveplanning.html5
-rw-r--r--archaeological_files_pdl/wizards.py24
3 files changed, 27 insertions, 19 deletions
diff --git a/archaeological_files_pdl/forms.py b/archaeological_files_pdl/forms.py
index 03c308ba5..393f53b8c 100644
--- a/archaeological_files_pdl/forms.py
+++ b/archaeological_files_pdl/forms.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2014 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# Copyright (C) 2014-2015 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -24,11 +24,10 @@ from django.core import validators
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
-from ishtar_common.models import Person, PersonType, valid_id
+from ishtar_common.models import Person, PersonType, Town, valid_id
from archaeological_files import models
from ishtar_common.forms import get_now, reverse_lazy
-from ishtar_common.forms_common import get_advanced_town_field
from archaeological_files.forms import GENERAL_CONTRACTOR, \
GENERAL_CONTRACTOR_ORGA, RESPONSIBLE_PLANNING_SERVICE, \
RESPONSIBLE_PLANNING_SERVICE_ORGA
@@ -75,10 +74,12 @@ class FileFormPreventiveType(forms.Form):
class FileFormPlanning(forms.Form):
form_label = _(u"Planning")
- associated_models = {'main_town': models.Town}
+ base_model = 'town'
+ associated_models = {'town': Town}
name = forms.CharField(label=_(u"Planning name"), required=False,
max_length=100)
- main_town = get_advanced_town_field(required=True)
+ town = widgets.MultipleAutocompleteField(
+ model=Town, label=_("Towns"), required=False)
locality = forms.CharField(label=_(u"Locality"), max_length=100,
required=False)
address = forms.CharField(
@@ -103,8 +104,10 @@ class FileFormPlanning(forms.Form):
class FileFormResearchAddress(forms.Form):
form_label = _(u"Address")
- associated_models = {'main_town': models.Town}
- main_town = get_advanced_town_field(required=True)
+ base_model = 'town'
+ associated_models = {'town': Town}
+ town = widgets.MultipleAutocompleteField(
+ model=Town, label=_("Towns"), required=False)
locality = forms.CharField(label=_(u"Locality"), max_length=100,
required=False)
address = forms.CharField(
diff --git a/archaeological_files_pdl/templates/ishtar/wizard/wizard_preventiveplanning.html b/archaeological_files_pdl/templates/ishtar/wizard/wizard_preventiveplanning.html
index 66569a66d..6bd5598b6 100644
--- a/archaeological_files_pdl/templates/ishtar/wizard/wizard_preventiveplanning.html
+++ b/archaeological_files_pdl/templates/ishtar/wizard/wizard_preventiveplanning.html
@@ -25,7 +25,10 @@
</tr>{% endif %}
<tr>
- <td>{{wizard.form.main_town|safe}}</td>
+ <th colspan='2'><label for="id_preventiveplanning-{{CURRENT_ACTION}}-towns">{% trans "Towns" %}</label></th>
+</tr>
+<tr>
+ <td>{{wizard.form.town|safe}}</td>
</tr>
<tr>
diff --git a/archaeological_files_pdl/wizards.py b/archaeological_files_pdl/wizards.py
index 2d3491c8d..c081d13d1 100644
--- a/archaeological_files_pdl/wizards.py
+++ b/archaeological_files_pdl/wizards.py
@@ -19,21 +19,22 @@
from archaeological_files.wizards import FileWizard as BaseFileWizard
+
class FileWizard(BaseFileWizard):
parcel_step_key = 'parcelspdl-'
town_step_keys = ['preventiveplanning-', 'researchaddress-']
- town_input_id = 'main_town'
+ town_input_id = 'town'
multi_towns = False
wizard_templates = {
- 'generalcontractor-%(url_name)s':\
- 'ishtar/wizard/wizard_generalcontractor.html',
- 'planningservice-%(url_name)s':\
- 'ishtar/wizard/wizard_planningservice.html',
- 'instruction-%(url_name)s':\
- 'ishtar/wizard/wizard_instruction.html',
- 'preventiveplanning-%(url_name)s':\
- 'ishtar/wizard/wizard_preventiveplanning.html',
- }
+ 'generalcontractor-%(url_name)s':
+ 'ishtar/wizard/wizard_generalcontractor.html',
+ 'planningservice-%(url_name)s':
+ 'ishtar/wizard/wizard_planningservice.html',
+ 'instruction-%(url_name)s':
+ 'ishtar/wizard/wizard_instruction.html',
+ 'preventiveplanning-%(url_name)s':
+ 'ishtar/wizard/wizard_preventiveplanning.html',
+ }
def get_current_year(self):
general_form_key = 'general-' + self.url_name
@@ -41,7 +42,7 @@ class FileWizard(BaseFileWizard):
def get_form_kwargs(self, *args, **kwargs):
returned = super(FileWizard, self).get_form_kwargs(*args, **kwargs)
- if args and (args[0].startswith('generalcontractor-') or
+ if args and (args[0].startswith('generalcontractor-') or
args[0].startswith('planningservice-')):
if 'status' in self.request.GET:
returned['status'] = self.request.GET['status']
@@ -49,5 +50,6 @@ class FileWizard(BaseFileWizard):
returned['year'] = self.get_current_year()
return returned
+
class FileModificationWizard(FileWizard):
modification = True