You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
748 B
30 lines
748 B
# -*- 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)
|
|
|