Initial commit

This commit is contained in:
Stefan Wehrmeyer 2022-02-15 21:09:09 +01:00
commit 19170142c3
20 changed files with 894 additions and 0 deletions

View file

@ -0,0 +1,24 @@
from django.utils.translation import gettext_lazy as _
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from .models import PLUGIN_TEMPLATES, GovernmentPlansCMSPlugin
@plugin_pool.register_plugin
class GovernmentPlansPlugin(CMSPluginBase):
name = _("Government plans")
model = GovernmentPlansCMSPlugin
filter_horizontal = ("categories",)
cache = True
def get_render_template(self, context, instance, placeholder):
return instance.template or PLUGIN_TEMPLATES[0][0]
def render(self, context, instance, placeholder):
context = super().render(context, instance, placeholder)
context["object_list"] = instance.get_plans(
context["request"], published_only=False
)
return context