|
|
|
@ -29,62 +29,3 @@ class PromoPluginPublisher(CMSPluginBase): |
|
|
|
return context |
|
|
|
return context |
|
|
|
|
|
|
|
|
|
|
|
plugin_pool.register_plugin(PromoPluginPublisher) # register the plugin |
|
|
|
plugin_pool.register_plugin(PromoPluginPublisher) # register the plugin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# from django.utils.translation import ugettext_lazy as _ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# from cms.models.pluginmodel import CMSPlugin |
|
|
|
|
|
|
|
# from cms.plugin_base import CMSPluginBase |
|
|
|
|
|
|
|
# from cms.plugin_pool import plugin_pool |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# from .models import ContextServicePlugin |
|
|
|
|
|
|
|
# from .forms import ContextServiceForm |
|
|
|
|
|
|
|
# from .settings import get_setting |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# class SevicePlugin(CMSPluginBase): |
|
|
|
|
|
|
|
# module = 'Sevice' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# class SeviceContextPlugin(SevicePlugin): |
|
|
|
|
|
|
|
# """ |
|
|
|
|
|
|
|
# Non cached plugin which returns the latest posts taking into account the |
|
|
|
|
|
|
|
# user / toolbar state |
|
|
|
|
|
|
|
# """ |
|
|
|
|
|
|
|
# render_template = 'sevice/plugins/context_services.html' |
|
|
|
|
|
|
|
# name = _('Context Services') |
|
|
|
|
|
|
|
# model = ContextServicePlugin |
|
|
|
|
|
|
|
# form = ContextServiceForm |
|
|
|
|
|
|
|
# filter_horizontal = ('categories',) |
|
|
|
|
|
|
|
# cache = False |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# def render(self, context, instance, placeholder): |
|
|
|
|
|
|
|
# context = super(SeviceContextPlugin, self).render(context, instance, placeholder) |
|
|
|
|
|
|
|
# context['services_list'] = instance.get_services(context['request']) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# if instance.categories.exists(): |
|
|
|
|
|
|
|
# context['category'] = instance.categories.all()[0].slug |
|
|
|
|
|
|
|
# else: |
|
|
|
|
|
|
|
# context['category'] = "all" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# return context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# class SeviceContextPluginCached(SevicePlugin): |
|
|
|
|
|
|
|
# """ |
|
|
|
|
|
|
|
# Cached plugin which returns the latest published posts |
|
|
|
|
|
|
|
# """ |
|
|
|
|
|
|
|
# render_template = 'sevice/plugins/context_services.html' |
|
|
|
|
|
|
|
# name = _('Context Services') |
|
|
|
|
|
|
|
# model = ContextServicePlugin |
|
|
|
|
|
|
|
# form = ContextServiceForm |
|
|
|
|
|
|
|
# filter_horizontal = ('categories',) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# def render(self, context, instance, placeholder): |
|
|
|
|
|
|
|
# context = super(SeviceContextPluginCached, self).render(context, instance, placeholder) |
|
|
|
|
|
|
|
# context['posts_list'] = instance.get_posts() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# return context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# plugin_pool.register_plugin(SeviceContextPlugin) |
|
|
|
|
|
|
|
|