Add UngleichHeaderWithTextAndImageSliderPlugin and UngleichHeaderItemPlugin

This commit is contained in:
PCoder 2017-11-19 13:19:01 +01:00
parent 7aca251260
commit d006ddcf0d

View file

@ -3,7 +3,8 @@ from cms.plugin_pool import plugin_pool
from .models import ( from .models import (
UngelichContactUsSection, UngelichTextSection, Service, ServiceItem, UngelichContactUsSection, UngelichTextSection, Service, ServiceItem,
About, AboutItem, SectionWithImage, UngleichServiceItem About, AboutItem, SectionWithImage, UngleichServiceItem, UngleichHeader,
UngleichHeaderItem
) )
@ -176,4 +177,35 @@ class UngleichServicesItemPlugin(CMSPluginBase):
context, instance, placeholder context, instance, placeholder
) )
context['instance'] = instance context['instance'] = instance
return context
@plugin_pool.register_plugin
class UngleichHeaderWithTextAndImageSliderPlugin(CMSPluginBase):
name = "ungleich Header with Text and Image Slider Plugin"
model = UngleichHeader
render_template = "ungleich_page/ungleich/header.html"
cache = False
allow_children = True
child_classes = ['UngleichHeaderItemPlugin']
def render(self, context, instance, placeholder):
context['instance'] = instance
return context
@plugin_pool.register_plugin
class UngleichHeaderItemPlugin(CMSPluginBase):
name = "ungleich Header Item Plugin"
model = UngleichHeaderItem
render_template = "ungleich_page/ungleich/_header_item.html"
cache = False
require_parent = True
parent_classes = ['UngleichHeaderWithTextAndImageSliderPlugin']
def render(self, context, instance, placeholder):
context = super(UngleichHeaderItemPlugin, self).render(
context, instance, placeholder
)
context['instance'] = instance
return context return context