Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Added django.core.extensions.load_and_render, which factors out the b…

…oilerplate of loading a template, rendering a context and returning an HttpResponse

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 63994a980131e15f08383fb441b26d259bd73f7f 1 parent bb87b21
@adrianholovaty adrianholovaty authored
Showing with 9 additions and 0 deletions.
  1. +9 −0 django/core/
9 django/core/
@@ -1,7 +1,16 @@
# Specialized template classes for Django, decoupled from the basic template system.
+from django.core import template_loader
from django.core.template import Context
from django.conf.settings import DEBUG, INTERNAL_IPS
+from django.utils.httpwrappers import HttpResponse
+def load_and_render(template_name, dictionary=None, context_class=None):
+ dictionary = dictionary or {}
+ context_class = context_class or Context
+ t = template_loader.get_template(template_name)
+ c = context_class(dictionary)
+ return HttpResponse(t.render(c))
class DjangoContext(Context):

0 comments on commit 63994a9

Please sign in to comment.
Something went wrong with that request. Please try again.