44import datetime , json
55
66from django .http import HttpResponseForbidden , HttpResponseRedirect , Http404
7- from django .shortcuts import render , render_to_response , get_object_or_404 , redirect
7+ from django .shortcuts import render , get_object_or_404 , redirect
88from django .core .urlresolvers import reverse as urlreverse
99from django .template .loader import render_to_string
10- from django .template import RequestContext
1110from django import forms
1211from django .conf import settings
1312
@@ -222,7 +221,7 @@ def edit_position(request, name, ballot_id):
222221
223222 ballot_deferred = doc .active_defer_event ()
224223
225- return render_to_response ( 'doc/ballot/edit_position.html' ,
224+ return render ( request , 'doc/ballot/edit_position.html' ,
226225 dict (doc = doc ,
227226 form = form ,
228227 ad = ad ,
@@ -232,8 +231,7 @@ def edit_position(request, name, ballot_id):
232231 ballot = ballot ,
233232 show_discuss_text = old_pos and old_pos .pos .blocking ,
234233 blocking_positions = json .dumps (blocking_positions ),
235- ),
236- context_instance = RequestContext (request ))
234+ ))
237235
238236
239237@role_required ('Area Director' ,'Secretariat' )
@@ -311,18 +309,17 @@ def send_ballot_comment(request, name, ballot_id):
311309
312310 cc_select_form = CcSelectForm (mailtrigger_slug = 'ballot_saved' ,mailtrigger_context = {'doc' :doc })
313311
314- return render_to_response ('doc/ballot/send_ballot_comment.html' ,
315- dict (doc = doc ,
316- subject = subject ,
317- body = body ,
318- frm = frm ,
319- to = addrs .as_strings ().to ,
320- ad = ad ,
321- can_send = d or c ,
322- back_url = back_url ,
323- cc_select_form = cc_select_form ,
324- ),
325- context_instance = RequestContext (request ))
312+ return render (request , 'doc/ballot/send_ballot_comment.html' ,
313+ dict (doc = doc ,
314+ subject = subject ,
315+ body = body ,
316+ frm = frm ,
317+ to = addrs .as_strings ().to ,
318+ ad = ad ,
319+ can_send = d or c ,
320+ back_url = back_url ,
321+ cc_select_form = cc_select_form ,
322+ ))
326323
327324@role_required ('Secretariat' )
328325def clear_ballot (request , name ):
@@ -337,10 +334,9 @@ def clear_ballot(request, name):
337334 do_undefer_ballot (request ,doc )
338335 return redirect ("doc_view" , name = doc .name )
339336
340- return render_to_response ( 'doc/ballot/clear_ballot.html' ,
337+ return render ( request , 'doc/ballot/clear_ballot.html' ,
341338 dict (doc = doc ,
342- back_url = doc .get_absolute_url ()),
343- context_instance = RequestContext (request ))
339+ back_url = doc .get_absolute_url ()))
344340
345341@role_required ('Area Director' ,'Secretariat' )
346342def defer_ballot (request , name ):
@@ -388,11 +384,10 @@ def defer_ballot(request, name):
388384
389385 return HttpResponseRedirect (doc .get_absolute_url ())
390386
391- return render_to_response ( 'doc/ballot/defer_ballot.html' ,
387+ return render ( request , 'doc/ballot/defer_ballot.html' ,
392388 dict (doc = doc ,
393389 telechat_date = telechat_date ,
394- back_url = doc .get_absolute_url ()),
395- context_instance = RequestContext (request ))
390+ back_url = doc .get_absolute_url ()))
396391
397392@role_required ('Area Director' ,'Secretariat' )
398393def undefer_ballot (request , name ):
@@ -413,11 +408,10 @@ def undefer_ballot(request, name):
413408 do_undefer_ballot (request ,doc )
414409 return HttpResponseRedirect (doc .get_absolute_url ())
415410
416- return render_to_response ( 'doc/ballot/undefer_ballot.html' ,
411+ return render ( request , 'doc/ballot/undefer_ballot.html' ,
417412 dict (doc = doc ,
418413 telechat_date = telechat_date ,
419- back_url = doc .get_absolute_url ()),
420- context_instance = RequestContext (request ))
414+ back_url = doc .get_absolute_url ()))
421415
422416class LastCallTextForm (forms .Form ):
423417 last_call_text = forms .CharField (widget = forms .Textarea , required = True )
@@ -477,9 +471,8 @@ def lastcalltext(request, name):
477471
478472 request_last_call (request , doc )
479473
480- return render_to_response ('doc/draft/last_call_requested.html' ,
481- dict (doc = doc ),
482- context_instance = RequestContext (request ))
474+ return render (request , 'doc/draft/last_call_requested.html' ,
475+ dict (doc = doc ))
483476
484477 if "regenerate_last_call_text" in request .POST :
485478 e = generate_last_call_announcement (request , doc )
@@ -497,15 +490,14 @@ def lastcalltext(request, name):
497490 if not doc .intended_std_level :
498491 need_intended_status = doc .file_tag ()
499492
500- return render_to_response ( 'doc/ballot/lastcalltext.html' ,
493+ return render ( request , 'doc/ballot/lastcalltext.html' ,
501494 dict (doc = doc ,
502495 back_url = doc .get_absolute_url (),
503496 last_call_form = form ,
504497 can_request_last_call = can_request_last_call ,
505498 can_make_last_call = can_make_last_call ,
506499 need_intended_status = need_intended_status ,
507- ),
508- context_instance = RequestContext (request ))
500+ ))
509501
510502class BallotWriteupForm (forms .Form ):
511503 ballot_writeup = forms .CharField (widget = forms .Textarea , required = True )
@@ -582,24 +574,22 @@ def ballot_writeupnotes(request, name):
582574 e .desc = "Ballot has been issued"
583575 e .save ()
584576
585- return render_to_response ( 'doc/ballot/ballot_issued.html' ,
577+ return render ( request , 'doc/ballot/ballot_issued.html' ,
586578 dict (doc = doc ,
587- back_url = doc .get_absolute_url ()),
588- context_instance = RequestContext (request ))
579+ back_url = doc .get_absolute_url ()))
589580
590581
591582 need_intended_status = ""
592583 if not doc .intended_std_level :
593584 need_intended_status = doc .file_tag ()
594585
595- return render_to_response ( 'doc/ballot/writeupnotes.html' ,
586+ return render ( request , 'doc/ballot/writeupnotes.html' ,
596587 dict (doc = doc ,
597588 back_url = doc .get_absolute_url (),
598589 ballot_issued = bool (doc .latest_event (type = "sent_ballot_announcement" )),
599590 ballot_writeup_form = form ,
600591 need_intended_status = need_intended_status ,
601- ),
602- context_instance = RequestContext (request ))
592+ ))
603593
604594class BallotRfcEditorNoteForm (forms .Form ):
605595 rfc_editor_note = forms .CharField (widget = forms .Textarea , label = "RFC Editor Note" , required = True )
@@ -646,12 +636,11 @@ def ballot_rfceditornote(request, name):
646636 # make sure form shows a blank RFC Editor Note
647637 form = BallotRfcEditorNoteForm (initial = dict (rfc_editor_note = " " ))
648638
649- return render_to_response ( 'doc/ballot/rfceditornote.html' ,
639+ return render ( request , 'doc/ballot/rfceditornote.html' ,
650640 dict (doc = doc ,
651641 back_url = doc .get_absolute_url (),
652642 ballot_rfceditornote_form = form ,
653- ),
654- context_instance = RequestContext (request ))
643+ ))
655644
656645class ApprovalTextForm (forms .Form ):
657646 approval_text = forms .CharField (widget = forms .Textarea , required = True )
@@ -701,14 +690,13 @@ def ballot_approvaltext(request, name):
701690 if not doc .intended_std_level :
702691 need_intended_status = doc .file_tag ()
703692
704- return render_to_response ( 'doc/ballot/approvaltext.html' ,
693+ return render ( request , 'doc/ballot/approvaltext.html' ,
705694 dict (doc = doc ,
706695 back_url = doc .get_absolute_url (),
707696 approval_text_form = form ,
708697 can_announce = can_announce ,
709698 need_intended_status = need_intended_status ,
710- ),
711- context_instance = RequestContext (request ))
699+ ))
712700
713701@role_required ('Secretariat' )
714702def approve_ballot (request , name ):
@@ -737,9 +725,7 @@ def approve_ballot(request, name):
737725 ballot_writeup += "\n \n " + e .text
738726
739727 if error_duplicate_rfc_editor_note :
740- return render_to_response ('doc/draft/rfceditor_note_duplicate_error.html' ,
741- dict (doc = doc ),
742- context_instance = RequestContext (request ))
728+ return render (request , 'doc/draft/rfceditor_note_duplicate_error.html' , {'doc' : doc })
743729
744730 if "NOT be published" in approval_text :
745731 action = "do_not_publish"
@@ -817,11 +803,10 @@ def approve_ballot(request, name):
817803
818804 return HttpResponseRedirect (doc .get_absolute_url ())
819805
820- return render_to_response ( 'doc/ballot/approve_ballot.html' ,
806+ return render ( request , 'doc/ballot/approve_ballot.html' ,
821807 dict (doc = doc ,
822808 action = action ,
823- announcement = announcement ),
824- context_instance = RequestContext (request ))
809+ announcement = announcement ))
825810
826811
827812class MakeLastCallForm (forms .Form ):
@@ -921,9 +906,8 @@ def make_last_call(request, name):
921906
922907 form = MakeLastCallForm (initial = initial )
923908
924- return render_to_response ( templ ,
909+ return render ( request , templ ,
925910 dict (doc = doc ,
926911 form = form ,
927912 announcement = announcement ,
928- ),
929- context_instance = RequestContext (request ))
913+ ))
0 commit comments