2016-02-08 08:42:26 +00:00
|
|
|
from cms.plugin_base import CMSPluginBase
|
|
|
|
from cms.plugin_pool import plugin_pool
|
2016-03-22 00:21:50 +00:00
|
|
|
from cms.wizards import wizard_base
|
2016-02-14 15:47:07 +00:00
|
|
|
from .models import DGGalleryPlugin, DGSupportersPlugin, Supporter
|
2016-02-08 08:42:26 +00:00
|
|
|
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
|
|
|
|
|
2016-02-13 20:28:46 +00:00
|
|
|
class CMSSupportersPlugin(CMSPluginBase):
|
|
|
|
name = _("Digital Glarus Supporters")
|
2016-02-14 15:47:07 +00:00
|
|
|
model = DGSupportersPlugin
|
2016-02-13 20:28:46 +00:00
|
|
|
render_template = "digitalglarus/supporters_plugin.html"
|
|
|
|
|
|
|
|
def render(self, context, instance, placeholder):
|
|
|
|
context.update({
|
2016-02-14 15:47:07 +00:00
|
|
|
'supporters': Supporter.objects.all().order_by('name'),
|
2016-02-13 20:28:46 +00:00
|
|
|
'object': instance,
|
|
|
|
'placeholder':placeholder
|
|
|
|
})
|
|
|
|
return context
|
|
|
|
|
2016-03-22 00:21:50 +00:00
|
|
|
|
|
|
|
|
2016-02-08 08:42:26 +00:00
|
|
|
plugin_pool.register_plugin(CMSGalleryPlugin)
|
2016-02-13 20:28:46 +00:00
|
|
|
plugin_pool.register_plugin(CMSSupportersPlugin)
|