Ryan Wilcox committed d8a2813

do NOT use render_to_response on this project, use base_render_to_response function

  • Participants
  • Parent commits 032b06c

Comments (0)

Files changed (2)


 def index(request):
     project_list = Project.objects.all()
-    return render_to_response('projects/index.html', 
+    return base_render_to_response(request, 'projects/index.html', 
         dict(projects= project_list)


 from django.core.context_processors import csrf
 from django.shortcuts import render_to_response
+from  django.template import RequestContext
 def safe_render_to_response(request, path, output_dict):
     """Does the correct CSRF wrapping for your views, because you can't use regular
     Specifically, we are doing option 3.2
+    output_dict.update( csrf(request) )
+    return render_to_response(path, output_dict, context_instance=RequestContext(request))
+def base_render_to_response(request, path, output_dict):
+    """This should be the default way, in this project, you render_to_response.
-    output_dict.update( csrf(request) )
-    return render_to_response(path, output_dict)
+    It sets up the context instance we need, so you don't have to."""
+    #the RequestContext is to support the auth framework. WD-rpw 07-09-2010
+    return render_to_response(path, output_dict, context_instance=RequestContext(request))