Replaces the return_to_url notion with logic that uses the session object. Related to bug #1430.
- Legacy-Id: 8305
This commit is contained in:
parent
a816098ee1
commit
feb57a04f0
|
@ -84,7 +84,6 @@ class EditPositionForm(forms.Form):
|
|||
position = forms.ModelChoiceField(queryset=BallotPositionName.objects.all(), widget=forms.RadioSelect, initial="norecord", required=True)
|
||||
discuss = forms.CharField(required=False, widget=forms.Textarea)
|
||||
comment = forms.CharField(required=False, widget=forms.Textarea)
|
||||
return_to_url = forms.CharField(required=False, widget=forms.HiddenInput)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
ballot_type = kwargs.pop("ballot_type")
|
||||
|
@ -106,8 +105,8 @@ def edit_position(request, name, ballot_id):
|
|||
|
||||
ad = login = request.user.person
|
||||
|
||||
if 'HTTP_REFERER' in request.META:
|
||||
return_to_url = request.META['HTTP_REFERER']
|
||||
if 'ballot_edit_return_point' in request.session:
|
||||
return_to_url = request.session['ballot_edit_return_point']
|
||||
else:
|
||||
return_to_url = urlreverse("doc_ballot", kwargs=dict(name=doc.name, ballot_id=ballot_id))
|
||||
|
||||
|
@ -130,9 +129,6 @@ def edit_position(request, name, ballot_id):
|
|||
# save the vote
|
||||
clean = form.cleaned_data
|
||||
|
||||
if clean['return_to_url']:
|
||||
return_to_url = clean['return_to_url']
|
||||
|
||||
pos = BallotPositionDocEvent(doc=doc, by=login)
|
||||
pos.type = "changed_ballot_position"
|
||||
pos.ballot = ballot
|
||||
|
@ -194,9 +190,9 @@ def edit_position(request, name, ballot_id):
|
|||
e.save() # save them after the position is saved to get later id for sorting order
|
||||
|
||||
if request.POST.get("send_mail"):
|
||||
qstr = "?return_to_url=%s" % return_to_url
|
||||
qstr=""
|
||||
if request.GET.get('ad'):
|
||||
qstr += "&ad=%s" % request.GET.get('ad')
|
||||
qstr += "?ad=%s" % request.GET.get('ad')
|
||||
return HttpResponseRedirect(urlreverse("doc_send_ballot_comment", kwargs=dict(name=doc.name, ballot_id=ballot_id)) + qstr)
|
||||
elif request.POST.get("Defer"):
|
||||
return redirect("doc_defer_ballot", name=doc)
|
||||
|
@ -211,9 +207,6 @@ def edit_position(request, name, ballot_id):
|
|||
initial['discuss'] = old_pos.discuss
|
||||
initial['comment'] = old_pos.comment
|
||||
|
||||
if return_to_url:
|
||||
initial['return_to_url'] = return_to_url
|
||||
|
||||
form = EditPositionForm(initial=initial, ballot_type=ballot.ballot_type)
|
||||
|
||||
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):
|
|||
|
||||
ad = request.user.person
|
||||
|
||||
return_to_url = request.GET.get('return_to_url')
|
||||
if not return_to_url:
|
||||
if 'ballot_edit_return_point' in request.session:
|
||||
return_to_url = request.session['ballot_edit_return_point']
|
||||
else:
|
||||
return_to_url = urlreverse("doc_ballot", kwargs=dict(name=doc.name, ballot_id=ballot_id))
|
||||
|
||||
if 'HTTP_REFERER' in request.META:
|
||||
|
|
|
@ -755,6 +755,8 @@ def document_ballot(request, name, ballot_id=None):
|
|||
|
||||
c = document_ballot_content(request, doc, ballot_id, editable=True)
|
||||
|
||||
request.session['ballot_edit_return_point'] = request.path_info
|
||||
|
||||
return render_to_response("doc/document_ballot.html",
|
||||
dict(doc=doc,
|
||||
top=top,
|
||||
|
|
|
@ -179,6 +179,7 @@ def agenda(request, date=None):
|
|||
data["sections"]["1.1"]["title"] = data["sections"]["1.1"]["title"].replace("Roll Call", '<a href="https://www.ietf.org/iesg/internal/rollcall.txt">Roll Call</a>')
|
||||
data["sections"]["1.3"]["title"] = data["sections"]["1.3"]["title"].replace("Minutes", '<a href="https://www.ietf.org/iesg/internal/minutes.txt">Minutes</a>')
|
||||
|
||||
request.session['ballot_edit_return_point'] = request.path_info
|
||||
return render_to_response("iesg/agenda.html", {
|
||||
"date": data["date"],
|
||||
"sections": sorted(data["sections"].iteritems()),
|
||||
|
@ -366,6 +367,7 @@ def agenda_documents(request):
|
|||
"sections": sorted((num, section) for num, section in sections.iteritems()
|
||||
if "2" <= num < "5")
|
||||
})
|
||||
request.session['ballot_edit_return_point'] = request.path_info
|
||||
return render(request, 'iesg/agenda_documents.html', { 'telechats': telechats })
|
||||
|
||||
def telechat_docs_tarfile(request, date):
|
||||
|
|
Loading…
Reference in a new issue