Ryan Wilcox avatar Ryan Wilcox committed d8a2813

do NOT use render_to_response on this project, use base_render_to_response function

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))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.