# -*- coding: utf-8 -*- from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from .models import PageTeasers class TeasersPlugin(CMSPluginBase): """Тизеры на странице.""" model = PageTeasers name = u'Тизеры' render_template = 'teasers/teasers_plugin.html' text_enabled = False admin_preview = False page_only = True allow_children = False filter_horizontal = ['teasers'] def render(self, context, instance, placeholder): context.update({ 'instance': instance, 'placeholder': placeholder, 'page_teasers': instance.teasers.all(), }) return context plugin_pool.register_plugin(TeasersPlugin)