Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 1b51d4c0cd
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (30 sloc) 1.372 kb
from django.utils.safestring import mark_safe
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
from cms.plugin_rendering import render_plugins
from stacks.fields import StackSearchField
from stacks.models import StackLink, Stack
from cms.plugins.utils import get_plugins
class StackPlugin(CMSPluginBase):
model = StackLink
name = _("Stack")
render_template = "cms/plugins/stacks.html"
admin_preview = False
def render(self, context, instance, placeholder):
# TODO: once we drop 2.3.x support we can just use the "render_plugin" templatetag
# instead of rendering html here.
plugins = get_plugins(context['request'], instance.stack.content)
processors = ()
html_content = mark_safe(u"".join(render_plugins(plugins, context, placeholder, processors)))
'instance': instance,
'placeholder': placeholder,
'content': html_content,
return context
def formfield_for_dbfield(self, db_field, request=None, **kwargs):
if == "stack":
return StackSearchField(**kwargs)
return super(StackPlugin, self).formfield_for_dbfield(db_field, request=None, **kwargs)
Jump to Line
Something went wrong with that request. Please try again.