From 30b1e5f9c364fd0d4f92d425d1647c82807b00cb Mon Sep 17 00:00:00 2001 From: rscnt Date: Sat, 13 Feb 2016 14:28:46 -0600 Subject: [PATCH] added supporters plugin Signed-off-by: rscnt --- digitalglarus/cms_plugins.py | 15 ++++++++++++++- .../digitalglarus/supporters_plugin.html | 14 ++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 digitalglarus/templates/digitalglarus/supporters_plugin.html diff --git a/digitalglarus/cms_plugins.py b/digitalglarus/cms_plugins.py index db317a67..03c54cae 100644 --- a/digitalglarus/cms_plugins.py +++ b/digitalglarus/cms_plugins.py @@ -1,6 +1,6 @@ from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool -from .models import DGGalleryPlugin +from .models import DGGalleryPlugin, Supporter from django.utils.translation import ugettext as _ class CMSGalleryPlugin(CMSPluginBase): @@ -16,4 +16,17 @@ class CMSGalleryPlugin(CMSPluginBase): }) 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) diff --git a/digitalglarus/templates/digitalglarus/supporters_plugin.html b/digitalglarus/templates/digitalglarus/supporters_plugin.html new file mode 100644 index 00000000..f4fbd349 --- /dev/null +++ b/digitalglarus/templates/digitalglarus/supporters_plugin.html @@ -0,0 +1,14 @@ +
+ {{placeholder}} +

WILLIWILLIWANKA

+{% for supporter in supporters %} +
+
+
+

{{supporter.name}}

+

{{supporter.description}}

+
+
+
+{% endfor %} +