mirror of
https://github.com/django/django.git
synced 2024-12-27 03:25:58 +00:00
Changed django.core.extensions.load_and_render to take context_instance instead of context_class keyword arg, so DjangoContext can be used
git-svn-id: http://code.djangoproject.com/svn/django/trunk@656 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
63994a9801
commit
0505000533
@ -5,11 +5,13 @@ from django.core.template import Context
|
|||||||
from django.conf.settings import DEBUG, INTERNAL_IPS
|
from django.conf.settings import DEBUG, INTERNAL_IPS
|
||||||
from django.utils.httpwrappers import HttpResponse
|
from django.utils.httpwrappers import HttpResponse
|
||||||
|
|
||||||
def load_and_render(template_name, dictionary=None, context_class=None):
|
def load_and_render(template_name, dictionary=None, context_instance=None):
|
||||||
dictionary = dictionary or {}
|
dictionary = dictionary or {}
|
||||||
context_class = context_class or Context
|
|
||||||
t = template_loader.get_template(template_name)
|
t = template_loader.get_template(template_name)
|
||||||
c = context_class(dictionary)
|
if context_instance:
|
||||||
|
c = context_instance.update(dictionary)
|
||||||
|
else:
|
||||||
|
c = Context(dictionary)
|
||||||
return HttpResponse(t.render(c))
|
return HttpResponse(t.render(c))
|
||||||
|
|
||||||
class DjangoContext(Context):
|
class DjangoContext(Context):
|
||||||
|
Loading…
Reference in New Issue
Block a user