コード例 #1
0
 def render(self, context, instance, placeholder):
     context.update(
         {
             "body": plugin_tags_to_user_html(instance.body, context, placeholder),
             "placeholder": placeholder,
             "object": instance,
         }
     )
     return context
コード例 #2
0
ファイル: checkout.py プロジェクト: khchine5/django-shop
 def render(self, context, instance, placeholder):
     self.super(AcceptConditionFormPlugin, self).render(context, instance, placeholder)
     accept_condition_form = context['accept_condition_form.plugin_{}'.format(instance.id)]
     html_content = self.html_parser.unescape(instance.glossary.get('html_content', ''))
     html_content = plugin_tags_to_user_html(html_content, context)
     # transfer the stored HTML content into the widget's label
     accept_condition_form['accept'].field.widget.choice_label = mark_safe(html_content)
     context['accept_condition_form'] = accept_condition_form
     return context
コード例 #3
0
 def render(self, context, instance, placeholder):
     super(AcceptConditionFormPlugin, self).render(context, instance, placeholder)
     accept_condition_form = context['accept_condition_form.plugin_{}'.format(instance.id)]
     html_content = self.html_parser.unescape(instance.glossary.get('html_content', ''))
     html_content = plugin_tags_to_user_html(html_content, context, placeholder)
     # transfer the stored HTML content into the widget's label
     accept_condition_form['accept'].field.widget.choice_label = mark_safe(html_content)
     context['accept_condition_form'] = accept_condition_form
     return context
コード例 #4
0
 def render(self, context, instance, placeholder):
     context.update({
         'body':
         plugin_tags_to_user_html(instance.body, context, placeholder),
         'placeholder':
         placeholder,
         'object':
         instance
     })
     return context
コード例 #5
0
 def render(self, context, instance, placeholder):
     context.update({
         'body': plugin_tags_to_user_html(
             instance.body,
             context,
             placeholder
         ),
         'placeholder': placeholder,
         'object': instance
     })
     return context
コード例 #6
0
 def render(self, context, instance, placeholder):
     # image shall be rendered in a responsive context using the ``<picture>`` element
     elements = utils.get_picture_elements(context, instance)
     caption = self.html_parser.unescape(instance.glossary.get('caption', ''))
     context.update({
         'is_responsive': True,
         'instance': instance,
         'caption': plugin_tags_to_user_html(caption, context, placeholder),
         'placeholder': placeholder,
         'elements': elements,
     })
     return super(CarouselSlidePlugin, self).render(context, instance, placeholder)
コード例 #7
0
 def render(self, context, instance, placeholder):
     # image shall be rendered in a responsive context using the ``<picture>`` element
     elements = utils.get_picture_elements(context, instance)
     caption = self.html_parser.unescape(
         instance.glossary.get('caption', ''))
     fluid = instance.get_complete_glossary().get('fluid') == 'on'
     if LooseVersion(djangocms_text_ckeditor_version) < LooseVersion(
             '3.2.1'):
         caption = plugin_tags_to_user_html(caption, context, placeholder)
     else:
         caption = plugin_tags_to_user_html(caption, context)
     context.update({
         'is_responsive': True,
         'instance': instance,
         'caption': caption,
         'is_fluid': fluid,
         'placeholder': placeholder,
         'elements': elements,
     })
     return super(CarouselSlidePlugin, self).render(context, instance,
                                                    placeholder)
コード例 #8
0
 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
コード例 #9
0
 def render(self, context, instance, placeholder):
     # image shall be rendered in a responsive context using the ``<picture>`` element
     elements = utils.get_picture_elements(context, instance)
     caption = self.html_parser.unescape(
         instance.glossary.get('caption', ''))
     context.update({
         'is_responsive':
         True,
         'instance':
         instance,
         'caption':
         plugin_tags_to_user_html(caption, context, placeholder),
         'placeholder':
         placeholder,
         'elements':
         elements,
     })
     return super(CarouselSlidePlugin, self).render(context, instance,
                                                    placeholder)
コード例 #10
0
 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
コード例 #11
0
    def render(self, context, instance, placeholder):
        context.update({
            'body':
            plugin_tags_to_user_html(instance.body, context, placeholder),
            'placeholder':
            placeholder,
            'object':
            instance
        })
        context['message'] = ''
        community = None

        user = context['request'].user
        if user.is_authenticated():
            try:
                cc3_profile = CC3Profile.viewable.get(
                    user=context['request'].user)
                community = cc3_profile.community
            except CC3Profile.DoesNotExist:
                pass

        if community:
            try:
                message = instance.communitymessage_set.get(
                    community=community)
                context['message'] = message.body
            except CommunityMessage.DoesNotExist:
                pass
            except MultipleObjectsReturned:
                message = instance.communitymessage_set.filter(
                    community=community).order_by('-pk')[0]
                context['message'] = message.body
        else:
            context['message'] = instance.body

        return context