dynamicweb/digitalglarus/cms_plugins.py
rscnt 30b1e5f9c3 added supporters plugin
Signed-off-by: rscnt <rascnt@gmail.com>
2016-02-13 14:28:46 -06:00

32 lines
1 KiB
Python

from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .models import DGGalleryPlugin, Supporter
from django.utils.translation import ugettext as _
class CMSGalleryPlugin(CMSPluginBase):
model = DGGalleryPlugin
name = _("Digital Glarus Gallery")
render_template = "digitalglarus/gallery.html"
def render(self, context, instance, placeholder):
context.update({
'gallery':instance.dgGallery,
'object':instance,
'placeholder':placeholder
})
return context
class CMSSupportersPlugin(CMSPluginBase):
name = _("Digital Glarus Supporters")
render_template = "digitalglarus/supporters_plugin.html"
def render(self, context, instance, placeholder):
context.update({
'supporters': Supporter.objects.all(),
'object': instance,
'placeholder':placeholder
})
return context
plugin_pool.register_plugin(CMSGalleryPlugin)
plugin_pool.register_plugin(CMSSupportersPlugin)