You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
819 B

from django.utils.translation import get_language
from feincms3.renderer import Regions, TemplatePluginRenderer
7 years ago
class MultilingualRegions(Regions):
def cache_key(self, region):
return '%s-%s' % (get_language(), super().cache_key(region))
7 years ago
class ContentPluginRenderer(TemplatePluginRenderer):
def register(self):
"""
7 years ago
Used as decorator
Usage:
@renderer.register()
class TextPlugin(ModelPlugin):
pass
"""
def _renderer_wrapper(plugin_class):
plugin_class.register_with_renderer(self)
return plugin_class
return _renderer_wrapper
def regions(self, item, inherit_from=None, regions=MultilingualRegions):
return super().regions(item, inherit_from=inherit_from, regions=regions)