From 609501f9876f1c1edb2128ab432eab0346002fe2 Mon Sep 17 00:00:00 2001 From: "M.Ravi" Date: Wed, 18 Oct 2017 16:56:41 +0200 Subject: [PATCH] Add GlasfaserAboutPlugin and GlasfaserAboutItemPlugin --- ungleich_page/cms_plugins.py | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/ungleich_page/cms_plugins.py b/ungleich_page/cms_plugins.py index 75e3b698..ba82801e 100644 --- a/ungleich_page/cms_plugins.py +++ b/ungleich_page/cms_plugins.py @@ -3,7 +3,7 @@ from cms.plugin_pool import plugin_pool from .models import ( UngelichPicture, UngelichContactUsSection, UngelichTextSection, Service, - ServiceItem + ServiceItem, About, AboutItem ) @@ -69,3 +69,31 @@ class GlasfaserServicesItemPlugin(CMSPluginBase): def render(self, context, instance, placeholder): context['instance'] = instance return context + + +@plugin_pool.register_plugin +class GlasfaserAboutPlugin(CMSPluginBase): + name = "Glasfaser About Plugin" + model = About + render_template = "ungleich_page/glasfaser/section_about.html" + cache = False + allow_children = True + child_classes = ['GlasfaserAboutItemPlugin'] + + def render(self, context, instance, placeholder): + context['about_instance'] = instance + return context + + +@plugin_pool.register_plugin +class GlasfaserAboutItemPlugin(CMSPluginBase): + name = "Glasfaser About Item Plugin" + model = AboutItem + render_template = "ungleich_page/glasfaser/_about_item.html" + cache = False + require_parent = True + parent_classes = ['GlasfaserAboutPlugin'] + + def render(self, context, instance, placeholder): + context['instance'] = instance + return context