Add ungleichproduct and ungleichproductitem plugins
This commit is contained in:
parent
16e5fb8f5c
commit
1e567ef6ad
3 changed files with 81 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ from cms.plugin_pool import plugin_pool
|
|||
from .models import (
|
||||
UngelichContactUsSection, UngelichTextSection, Service, ServiceItem,
|
||||
About, AboutItem, SectionWithImage, UngleichServiceItem, UngleichHeader,
|
||||
UngleichHeaderItem
|
||||
UngleichHeaderItem, UngleichProductItem, UngleichProduct
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -208,4 +208,36 @@ class UngleichHeaderItemPlugin(CMSPluginBase):
|
|||
context, instance, placeholder
|
||||
)
|
||||
context['instance'] = instance
|
||||
return context
|
||||
return context
|
||||
|
||||
|
||||
@plugin_pool.register_plugin
|
||||
class UngleichProductsPlugin(CMSPluginBase):
|
||||
name = "ungleich Products Plugin"
|
||||
model = UngleichProduct
|
||||
render_template = "ungleich_page/ungleich/section_products.html"
|
||||
cache = False
|
||||
allow_children = True
|
||||
child_classes = ['UngleichProductsItemPlugin']
|
||||
|
||||
def render(self, context, instance, placeholder):
|
||||
context['product_instance'] = instance
|
||||
context['section_id'] = get_section_id(instance, 'products')
|
||||
return context
|
||||
|
||||
|
||||
@plugin_pool.register_plugin
|
||||
class UngleichProductsItemPlugin(CMSPluginBase):
|
||||
name = "ungleich Product Item Plugin"
|
||||
model = UngleichProductItem
|
||||
render_template = "ungleich_page/ungleich/_products_item.html"
|
||||
cache = False
|
||||
require_parent = True
|
||||
parent_classes = ['UngleichProductsPlugin']
|
||||
|
||||
def render(self, context, instance, placeholder):
|
||||
context = super(UngleichProductsItemPlugin, self).render(
|
||||
context, instance, placeholder
|
||||
)
|
||||
context['instance'] = instance
|
||||
return context
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue