summaryrefslogtreecommitdiff
path: root/chimere/views.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2012-10-07 23:32:49 +0200
committerÉtienne Loks <etienne.loks@peacefrogs.net>2012-10-07 23:32:49 +0200
commit4688f763a074f78b20bd17494053c81b8c9ef3b8 (patch)
tree0cd3c0f2efcd83fc2d09639c053dae9e47080c9c /chimere/views.py
parentac8805e81c362d5bfe7d84583e8dfc5441ae82a1 (diff)
downloadChimère-4688f763a074f78b20bd17494053c81b8c9ef3b8.tar.bz2
Chimère-4688f763a074f78b20bd17494053c81b8c9ef3b8.zip
Forms: fix geographic init after a bad submission
Diffstat (limited to 'chimere/views.py')
-rw-r--r--chimere/views.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/chimere/views.py b/chimere/views.py
index 9a9a09a..f96a66b 100644
--- a/chimere/views.py
+++ b/chimere/views.py
@@ -261,6 +261,9 @@ def edit(request, area_name="", item_id=None, submited=False):
declared_fields = PropertyModel.objects.filter(available=True).all()
filtered_properties = PropertyModel.objects.filter(available=True,
subcategories__id__isnull=False).all()
+ point_value = init_item.point if init_item else None
+ if request.POST and request.POST.get('point'):
+ point_value = request.POST.get('point')
response_dct.update({
'actions':actions,
'action_selected':('contribute', 'edit'),
@@ -273,7 +276,7 @@ def edit(request, area_name="", item_id=None, submited=False):
'marker_id':item_id,
'sub_categories':sub_categories,
'point_widget':PointChooserWidget().render('point',
- init_item.point if init_item else None,
+ point_value,
area_name=response_dct['area_name']),
'properties':declared_fields,
'filtered_properties':filtered_properties,
@@ -366,6 +369,9 @@ def editRoute(request, area_name="", item_id=None, submited=False):
declared_fields = form.declared_fields.keys()
if 'description' in declared_fields:
declared_fields.pop(declared_fields.index('description'))
+ route_value = init_item.route if init_item else None
+ if request.POST and request.POST.get('route'):
+ route_value = request.POST.get('route')
response_dct.update({
'actions':actions,
'action_selected':('contribute', 'edit-route'),
@@ -377,8 +383,7 @@ def editRoute(request, area_name="", item_id=None, submited=False):
'dated':settings.CHIMERE_DAYS_BEFORE_EVENT,
'extra_head':form.media,
'sub_categories':sub_categories,
- 'route_widget':RouteChooserWidget().render('route',
- init_item.route if init_item else None,
+ 'route_widget':RouteChooserWidget().render('route', route_value,
area_name=response_dct['area_name'], routefile_id='',),
'properties':declared_fields,
'submited':submited