general: use render_cell templatetag in ajax call (#16301)
This commit is contained in:
parent
da590a77ae
commit
54a60e584a
|
@ -28,7 +28,7 @@ from django.db import transaction
|
|||
from django.http import (Http404, HttpResponse, HttpResponseRedirect,
|
||||
HttpResponsePermanentRedirect)
|
||||
from django.shortcuts import render, resolve_url
|
||||
from django.template import RequestContext, loader
|
||||
from django.template import RequestContext, Template
|
||||
from django.utils import lorem_ipsum, timezone
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
|
@ -83,6 +83,7 @@ def ajax_page_cell(request, page_pk, cell_reference):
|
|||
context = RequestContext(request, {
|
||||
'page': page,
|
||||
'request': request,
|
||||
'cell': cell,
|
||||
'synchronous': True,
|
||||
'site_base': request.build_absolute_uri('/')[:-1],
|
||||
})
|
||||
|
@ -96,13 +97,8 @@ def ajax_page_cell(request, page_pk, cell_reference):
|
|||
# Cell can pass data through its own __dict__
|
||||
cell.modify_global_context(context, request)
|
||||
|
||||
# FIXME: we bind to an existing template to have the list of
|
||||
# context processors applied to the RequestContext; the
|
||||
# CellBase.render() method should be extended to accept an additional
|
||||
# request parameter, to match the new Template::render() signature.
|
||||
template = loader.get_template('combo/page_template.html')
|
||||
with context.bind_template(template.template):
|
||||
return HttpResponse(cell.render(context), content_type='text/html')
|
||||
template = Template('{% load combo %}{% render_cell cell %}')
|
||||
return HttpResponse(template.render(context), content_type='text/html')
|
||||
|
||||
|
||||
def extend_with_parent_cells(cells):
|
||||
|
|
Loading…
Reference in New Issue