diff options
author | Étienne Loks <etienne.loks@proxience.com> | 2014-12-22 12:55:56 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@proxience.com> | 2015-05-06 15:34:36 +0200 |
commit | ee6a1eb3588da3c6c1c3f0e75691541cea2d37ab (patch) | |
tree | 0d369c66f0fb06db3d99e55523623468db02d619 /archaeological_operations/wizards.py | |
parent | 35b163e7626a0f556ad32b303c1b9fa94cdf1d3e (diff) | |
download | Ishtar-ee6a1eb3588da3c6c1c3f0e75691541cea2d37ab.tar.bz2 Ishtar-ee6a1eb3588da3c6c1c3f0e75691541cea2d37ab.zip |
Workon alternate administrativ wizard
* reorganization of address fields
* add a main town field
* reorganize parcel wizard
* workon new administrativ wizard
Diffstat (limited to 'archaeological_operations/wizards.py')
-rw-r--r-- | archaeological_operations/wizards.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/archaeological_operations/wizards.py b/archaeological_operations/wizards.py index 1e4de70b7..7fdc26b12 100644 --- a/archaeological_operations/wizards.py +++ b/archaeological_operations/wizards.py @@ -39,6 +39,9 @@ class OperationWizard(Wizard): model = models.Operation object_parcel_type = 'operation' parcel_step_key = 'parcelsgeneral-' + town_step_key = 'towns-' # step contening the current(s) town(s) + town_input_id = 'town' # input id of the current(s) town(s) + multi_towns = True # true if current town are multi wizard_done_window = reverse_lazy('show-operation') def get_template_names(self): @@ -47,8 +50,7 @@ class OperationWizard(Wizard): if current_step.startswith('towns-'): #templates = ['ishtar/wizard/towns_wizard.html'] + templates pass - if current_step.startswith('parcels-') or \ - current_step.startswith('parcelsgeneral-') : + if current_step.startswith(self.parcel_step_key): templates = ['ishtar/wizard/parcels_wizard.html'] + templates return templates @@ -131,16 +133,18 @@ class OperationWizard(Wizard): # manage the dynamic choice of towns if step.startswith('towns') and hasattr(form, 'management_form'): data['TOWNS'] = self.get_towns() - elif step.startswith('parcels') and hasattr(form, 'management_form'): + elif step.startswith(self.parcel_step_key) \ + and hasattr(form, 'management_form'): file = self.get_current_file() if file: data['PARCELS'] = self.get_available_parcels(file) else: - town_form_key = step.startswith('parcelsgeneral') \ - and 'townsgeneral-' or 'towns-' - town_form_key += self.url_name - town_ids = self.session_get_value(town_form_key, 'town', - multi=True) or [] + town_form_key = self.town_step_key + self.url_name + town_ids = self.session_get_value(town_form_key, + self.town_input_id, + multi=self.multi_towns) or [] + if not self.multi_towns and town_ids: + town_ids = [town_ids] towns = [] for town_id in town_ids: try: |