Example #1
0
    def render(self, name, value, attrs=None, renderer=None):
        if renderer is None:
            renderer = get_default_renderer()
        if value is None:
            value = ""
        final_attrs = self.build_attrs(self.attrs, attrs, name=name)
        self._set_config()
        external_plugin_resources = [
            [force_str(a), force_str(b), force_str(c)]
            for a, b, c in self.external_plugin_resources
        ]

        return mark_safe(
            renderer.render(
                "ckeditor/widget.html",
                {
                    "final_attrs": flatatt(final_attrs),
                    "value": conditional_escape(force_str(value)),
                    "id": final_attrs["id"],
                    "config": json_encode(self.config),
                    "external_plugin_resources": json_encode(
                        external_plugin_resources),
                },
            )
        )
Example #2
0
    def render(self, name, value, attrs=None, renderer=None):
        if renderer is None:
            renderer = get_default_renderer()
        if value is None:
            value = ''
        final_attrs = self.build_attrs(self.attrs, attrs, name=name)
        self._set_config()
        external_plugin_resources = [[
            force_text(a), force_text(b),
            force_text(c)
        ] for a, b, c in self.external_plugin_resources]

        return mark_safe(
            renderer.render(
                'ckeditor/widget.html', {
                    'final_attrs':
                    flatatt(final_attrs),
                    'value':
                    conditional_escape(force_text(value)),
                    'id':
                    final_attrs['id'],
                    'config':
                    json_encode(self.config),
                    'external_plugin_resources':
                    json_encode(external_plugin_resources)
                }))
Example #3
0
    def render(self, name, value, attrs=None, renderer=None):
        if renderer is None:
            renderer = get_default_renderer()
        if value is None:
            value = ''

        return mark_safe(renderer.render('ueditor/widget.html', {
            'value': conditional_escape(force_text(value)),
            'config': json_encode(self.config),
            'name': name,
        }))
Example #4
0
 def render(self, name, value, attrs=None, renderer=None):
     if renderer is None:
         renderer = get_default_renderer()
     if value is None:
         value = ''
     final_attrs = self.build_attrs(self.attrs, attrs, name=name)
     return mark_safe(renderer.render('wangeditor/widget.html', {
         'final_attrs': flatatt(final_attrs), # flatatt  设置html 的属性, 形式key=value
         'value': force_text(value),
         'config': json_encode(self.config),
         'id': final_attrs['id'],
     }))
Example #5
0
 def render(self, name, value, attrs=None, renderer=None):
     if not renderer:
         renderer = get_default_renderer()
     context = self.get_context(name, value, attrs)
     if value:
         areaMsg = {0: "province", 1: "city", 2: "district", 3: "county"}
         areaData = value.split('/')
         cityPickerMsg = {
             areaMsg[i]: areaData[i]
             for i in range(len(areaData))
         }
         context.update({'cityPickerMsg': cityPickerMsg})
     return mark_safe(renderer.render('citypicker/citypicker.html',
                                      context))
Example #6
0
    def render(self, value, name, attrs=None, renderer=None):
        if renderer is None:
            renderer = get_default_renderer()
        if value is None:
            value = ""
        final_attrs = self.build_attrs(self.attrs, attrs, name=name)

        return mark_safe(
            renderer.render(
                'widget.html', {
                    'final_attrs': flatatt(final_attrs),
                    'value': conditional_escape(force_text(value)),
                    'id': final_attrs['id'],
                    'config': self.config,
                }))
Example #7
0
    def render(self, name, value, attrs=None, renderer=None):
        if value is None:
            value = ''
        final_attrs = self.build_attrs(self.attrs, attrs, name=name)

        params = ('simditor/widget.html', {
            'final_attrs': flatatt(final_attrs),
            'value': conditional_escape(force_text(value)),
            'id': final_attrs['id'],
            'config': JSON_ENCODE(self.config)
        })

        if renderer is None and IS_NEW_WIDGET:
            renderer = get_default_renderer()

        data = renderer.render(*params) if IS_NEW_WIDGET else render_to_string(*params)

        return mark_safe(data)