diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-06-16 17:30:58 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2011-06-16 17:30:58 +0200 |
commit | 48691eebe6c933ffb3a9d41ba0ee09ff7d574a2d (patch) | |
tree | 3e45cda8ef3d4675de80bfe673883f20b3f4b3fc | |
parent | 0844c9a52a31f43d93e00910314803da603a4d5d (diff) | |
download | Ishtar-48691eebe6c933ffb3a9d41ba0ee09ff7d574a2d.tar.bz2 Ishtar-48691eebe6c933ffb3a9d41ba0ee09ff7d574a2d.zip |
Correct choose of town for parcel in operations (closes #484)
-rw-r--r-- | ishtar/furnitures/forms_operations.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ishtar/furnitures/forms_operations.py b/ishtar/furnitures/forms_operations.py index c362a21e4..c83b9f450 100644 --- a/ishtar/furnitures/forms_operations.py +++ b/ishtar/furnitures/forms_operations.py @@ -109,7 +109,6 @@ class OperationWizard(Wizard): if not step: step = self.determine_step(request, storage) form = self.get_form_list(request, storage)[step] - general_form_key = 'general-' + self.url_name # put hidden year field for refs if data and step.startswith('refs-') \ @@ -119,9 +118,9 @@ class OperationWizard(Wizard): [general_form_key][general_form_key+"-year"]) data[prefix+'-hidden_year'] = year # manage the dynamic choice of towns - if step.startswith('towns-') and hasattr(form, 'management_form'): + if step.startswith('towns') and hasattr(form, 'management_form'): data['TOWNS'] = self.get_towns(request, storage) - elif step.startswith('parcels-') and hasattr(form, 'management_form'): + elif step.startswith('parcels') and hasattr(form, 'management_form'): file_id = self.session_get_value(request, storage, general_form_key, "associated_file") if file_id: @@ -134,10 +133,12 @@ class OperationWizard(Wizard): pass data['PARCELS'] = sorted(parcels, key=lambda x:x[1]) else: - towns = [] - town_form_key = 'towns-' + self.url_name + town_form_key = step.startswith('parcelsgeneral') \ + and 'townsgeneral-' or 'towns-' + town_form_key += self.url_name town_ids = self.session_get_value(request, storage, town_form_key, 'town', multi=True) or [] + towns = [] for town_id in town_ids: try: town = models.Town.objects.get(pk=int(town_id)) |