def render(self, context, instance, placeholder): context.update({ 'body':plugin_tags_to_user_html(instance.body, context, placeholder), 'placeholder':placeholder, 'object':instance }) return context
def render(self, context, instance, placeholder): context.update({ "body": plugin_tags_to_user_html(instance.body, context, placeholder), "topic": instance.topic, "css": instance.get_css_display(), "placeholder": placeholder, "object": instance, }) return context
def render(self, context, instance, placeholder): context.update({ 'span': instance.span, 'title': instance.title, 'font': instance.font, 'body': plugin_tags_to_user_html(instance.body, context, placeholder), 'placeholder': placeholder, 'object': instance }) return context
def render(self, context, instance, placeholder): if settings.CMS_DBGETTEXT: from dbgettext.parser import parsed_gettext instance.body = parsed_gettext(instance, 'body') context.update({ 'body': plugin_tags_to_user_html(instance.body, context, placeholder), 'placeholder': placeholder, 'object': instance }) return context
def render(self, context, instance, placeholder): context.update({ 'body': plugin_tags_to_user_html(instance.body, context, placeholder), 'placeholder': placeholder, 'object': instance }) return context
def render(self, context, instance, placeholder): context.update( { "button": instance, "placeholder": placeholder, "body": plugin_tags_to_user_html(instance.body, context, placeholder), "link": instance.page_link.get_absolute_url(), } ) return context
def render(self, context, instance, placeholder): from django.template.defaultfilters import slugify context.update({ 'body': plugin_tags_to_user_html(instance.body, context, placeholder), 'topic': instance.topic, 'name': slugify(instance.topic), 'css': instance.get_css_display(), 'placeholder': placeholder, 'object': instance, }) return context
def render(self, context, instance, placeholder): if hasattr(settings, 'CMS_DBGETTEXT') and getattr(settings, 'CMS_DBGETTEXT'): from dbgettext.parser import parsed_gettext instance.topic = parsed_gettext(instance, 'topic') instance.body = parsed_gettext(instance, 'body') context.update({ 'body':plugin_tags_to_user_html(instance.body, context, placeholder), 'topic':instance.topic, 'css' : instance.get_css_display(), 'placeholder':placeholder, 'object':instance, }) return context
def render(self, context, instance, placeholder): if settings.CMS_DBGETTEXT: from dbgettext.parser import parsed_gettext #@UnresolvedImport instance.body = parsed_gettext(instance, 'body') context.update({ 'body': plugin_tags_to_user_html(instance.body, context, placeholder), 'placeholder': placeholder, 'object': instance }) self.render_template = Template(instance.body) return context
def render(self, context, instance, placeholder): #if a faqentry is not specified, choose one at random if not instance.link: faqentry_plugins = [] #get all FaqEntryPlugins plugins = CMSPlugin.objects.filter(plugin_type='CMSFaqEntryPlugin') #make a list of the faqentry plugin objects for plugin in plugins: faqentry_plugins.append(plugin.faqentry) try: #choose a random one import random instance.link = random.sample(faqentry_plugins, 1)[0] #set the page id of the linked faqentry page_id = instance.link.page_id except (ValueError, AttributeError): #since this didn't work, we assume no plugin exists raise ValueError("No FaqEntryPlugin was returned. Make sure one exists and is published.") #truncate the entry's body if instance.truncate_body and instance.link.body: instance.link.body = truncate_words(instance.link.body, instance.truncate_body) #show the entry's body or not if not instance.show_body: instance.link.body = '' #create the link URL #if page_id was not set randomly try: page_id except (NameError, UnboundLocalError): page_id = instance.faqentrylink.link.page_id # import ipdb; ipdb.set_trace() #check if multilingual middleware is installed if 'cms.middleware.multilingual.MultilingualURLMiddleware' in settings.MIDDLEWARE_CLASSES: url = '/' + instance.link.language + Page.objects.get(id=page_id).get_absolute_url(language=instance.link.language) else: url = Page.objects.get(id=page_id).get_absolute_url() context.update({ 'body': plugin_tags_to_user_html(instance.link.body, context, placeholder), 'topic': instance.link.topic, 'url': url, 'css': instance.get_css_display(), 'placeholder': placeholder, 'object': instance, }) return context
def render(self, context, instance, placeholder): wrappers = [w[1] for w in settings.CMS_TEXT_WRAPPERS if w[0] == instance.wrapper] if wrappers: instance.render_template = wrappers[0].get('render_template') context.update(wrappers[0].get('extra_context', {})) extra_classes = [] for csscls in instance.classes: try: extra_classes.append(dict(instance.CLASSES)[int(csscls)]) except (ValueError, IndexError): pass context['extra_classes'] = ' '.join(extra_classes) context.update({ 'body': plugin_tags_to_user_html(instance.body, context, placeholder), 'placeholder': placeholder, 'object': instance, }) return context
def render(self, context, instance, placeholder): if settings.CMS_DBGETTEXT: from dbgettext.parser import parsed_gettext instance.topic = parsed_gettext(instance, 'topic') instance.body = parsed_gettext(instance, 'body') context.update({ 'body': plugin_tags_to_user_html(instance.body, context, placeholder), 'topic': instance.topic, 'css': instance.get_css_display(), 'placeholder': placeholder, 'object': instance, }) return context
def render(self, context, instance, placeholder): # import ipdb; ipdb.set_trace() #if a faqentry is not specified, choose one at random if not instance.link: faqentry_plugins = [] #get all FaqEntryPlugins plugins = CMSPlugin.objects.filter(plugin_type='CMSFaqEntryPlugin') #make a list of the faqentry plugin objects for plugin in plugins: faqentry_plugins.append(plugin.faqentry) try: #choose a random one import random instance.link = random.sample(faqentry_plugins, 1)[0] #set the page id of the linked faqentry page_id = instance.link.page_id except (ValueError, AttributeError): #since this didn't work, we assume no plugin exists raise ValueError("No FaqEntryPlugin was returned. Make sure one exists and is published.") #truncate the entry's body if instance.truncate_body and instance.link.body: instance.link.body = truncate_words(instance.link.body, instance.truncate_body) #show the entry's body or not if not instance.show_body: instance.link.body = '' context.update({ 'body':plugin_tags_to_user_html(instance.link.body, context, placeholder), 'topic':instance.link.topic, 'url': instance.link.get_absolute_url(), 'placeholder':placeholder, 'object':instance, 'css' : instance.get_css_display(), }) return context
def render(self, context, instance, placeholder): wrappers = [ w[1] for w in settings.CMS_TEXT_WRAPPERS if w[0] == instance.wrapper ] if wrappers: instance.render_template = wrappers[0].get('render_template') context.update(wrappers[0].get('extra_context', {})) extra_classes = [] for csscls in instance.classes: try: extra_classes.append(dict(instance.CLASSES)[int(csscls)]) except (ValueError, IndexError): pass context['extra_classes'] = ' '.join(extra_classes) context.update({ 'body': plugin_tags_to_user_html(instance.body, context, placeholder), 'placeholder': placeholder, 'object': instance, }) return context
def render(self, context, instance, placeholder): #if a faqentry is not specified, choose one at random if not instance.link: faqentry_plugins = [] #get all FaqEntryPlugins plugins = CMSPlugin.objects.filter(plugin_type='CMSFaqEntryPlugin') #make a list of the faqentry plugin objects for plugin in plugins: faqentry_plugins.append(plugin.faqentry) try: #choose a random one import random instance.link = random.sample(faqentry_plugins, 1)[0] #set the page id of the linked faqentry page_id = instance.link.page_id except (ValueError, AttributeError ): #since this didn't work, we assume no plugin exists raise ValueError( "No FaqEntryPlugin was returned. Make sure one exists and is published." ) #truncate the entry's body if instance.truncate_body and instance.link.body: instance.link.body = truncate_words(instance.link.body, instance.truncate_body) #show the entry's body or not if not instance.show_body: instance.link.body = '' #create the link URL #if page_id was not set randomly try: page_id except (NameError, UnboundLocalError): page_id = instance.faqentrylink.link.page_id # import ipdb; ipdb.set_trace() #check if multilingual middleware is installed if 'cms.middleware.multilingual.MultilingualURLMiddleware' in settings.MIDDLEWARE_CLASSES: url = '/' + instance.link.language + Page.objects.get( id=page_id).get_absolute_url(language=instance.link.language) else: url = Page.objects.get(id=page_id).get_absolute_url() context.update({ 'body': plugin_tags_to_user_html(instance.link.body, context, placeholder), 'topic': instance.link.topic, 'url': url, 'css': instance.get_css_display(), 'placeholder': placeholder, 'object': instance, }) return context
def render(self, context, instance, placeholder): return {'body':plugin_tags_to_user_html(instance.body, context, placeholder), 'placeholder':placeholder}
def render(self, context, instance, placeholder): return {"body": plugin_tags_to_user_html(instance.body, context, placeholder), "placeholder": placeholder}