@@ -84,7 +84,6 @@ class EditPositionForm(forms.Form):
8484 position = forms .ModelChoiceField (queryset = BallotPositionName .objects .all (), widget = forms .RadioSelect , initial = "norecord" , required = True )
8585 discuss = forms .CharField (required = False , widget = forms .Textarea )
8686 comment = forms .CharField (required = False , widget = forms .Textarea )
87- return_to_url = forms .CharField (required = False , widget = forms .HiddenInput )
8887
8988 def __init__ (self , * args , ** kwargs ):
9089 ballot_type = kwargs .pop ("ballot_type" )
@@ -106,8 +105,8 @@ def edit_position(request, name, ballot_id):
106105
107106 ad = login = request .user .person
108107
109- if 'HTTP_REFERER ' in request .META :
110- return_to_url = request .META [ 'HTTP_REFERER ' ]
108+ if 'ballot_edit_return_point ' in request .session :
109+ return_to_url = request .session [ 'ballot_edit_return_point ' ]
111110 else :
112111 return_to_url = urlreverse ("doc_ballot" , kwargs = dict (name = doc .name , ballot_id = ballot_id ))
113112
@@ -130,9 +129,6 @@ def edit_position(request, name, ballot_id):
130129 # save the vote
131130 clean = form .cleaned_data
132131
133- if clean ['return_to_url' ]:
134- return_to_url = clean ['return_to_url' ]
135-
136132 pos = BallotPositionDocEvent (doc = doc , by = login )
137133 pos .type = "changed_ballot_position"
138134 pos .ballot = ballot
@@ -194,9 +190,9 @@ def edit_position(request, name, ballot_id):
194190 e .save () # save them after the position is saved to get later id for sorting order
195191
196192 if request .POST .get ("send_mail" ):
197- qstr = "?return_to_url=%s" % return_to_url
193+ qstr = ""
198194 if request .GET .get ('ad' ):
199- qstr += "& ad=%s" % request .GET .get ('ad' )
195+ qstr += "? ad=%s" % request .GET .get ('ad' )
200196 return HttpResponseRedirect (urlreverse ("doc_send_ballot_comment" , kwargs = dict (name = doc .name , ballot_id = ballot_id )) + qstr )
201197 elif request .POST .get ("Defer" ):
202198 return redirect ("doc_defer_ballot" , name = doc )
@@ -211,9 +207,6 @@ def edit_position(request, name, ballot_id):
211207 initial ['discuss' ] = old_pos .discuss
212208 initial ['comment' ] = old_pos .comment
213209
214- if return_to_url :
215- initial ['return_to_url' ] = return_to_url
216-
217210 form = EditPositionForm (initial = initial , ballot_type = ballot .ballot_type )
218211
219212 blocking_positions = dict ((p .pk , p .name ) for p in form .fields ["position" ].queryset .all () if p .blocking )
@@ -242,8 +235,9 @@ def send_ballot_comment(request, name, ballot_id):
242235
243236 ad = request .user .person
244237
245- return_to_url = request .GET .get ('return_to_url' )
246- if not return_to_url :
238+ if 'ballot_edit_return_point' in request .session :
239+ return_to_url = request .session ['ballot_edit_return_point' ]
240+ else :
247241 return_to_url = urlreverse ("doc_ballot" , kwargs = dict (name = doc .name , ballot_id = ballot_id ))
248242
249243 if 'HTTP_REFERER' in request .META :
0 commit comments