views,templates: render sekizai js and css blocks when rendering a plugin out of page

It's needed bug plugin with js behavior.
This commit is contained in:
Benjamin Dauvergne 2014-02-10 08:37:17 +01:00
parent fc17cd4689
commit 7f1027f956
4 changed files with 8 additions and 3 deletions

View File

@ -6,7 +6,7 @@ from cms.plugin_pool import plugin_pool
class AjaxTextPlugin(TextPlugin):
name = _(u'Text (asynchronous loading)')
ajax_render_template = 'plugin/ajax_text.html'
ajax_render_template = 'cms_ajax_text_plugin/plugin.html'
text_enabled = True
def get_ajax_body(self, instance, context):

View File

@ -0,0 +1,4 @@
{% load sekizai_tags %}
{{ content|safe }}
{% render_block "js" %}
{% render_block "css" %}

View File

@ -1,5 +1,5 @@
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response
from cms.models import CMSPlugin
@ -8,4 +8,5 @@ def ajax_render(request, plugin_id):
plugin = CMSPlugin.objects.get(pk=plugin_id)
context = RequestContext(request)
rendered = plugin.render_plugin(context)
return HttpResponse(rendered)
return render_to_response('cms_ajax_text_plugin/view.html',
{'content': rendered}, context)