widgets.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:pyconjp-website 作者: pyconjp 项目源码 文件源码
def render(self, name, value, attrs=None):

        # Prepare values
        attrs = self.build_attrs(attrs, name=name)
        if not value:
            value = ''

        options = getattr(settings, 'MARKEDIT_DEFAULT_SETTINGS', {})

        if 'options' in attrs:
            options = self._eval_value(attrs['options'], {})
            del attrs['options']

        # Render widget to HTML
        t = loader.get_template('markedit/ui.html')
        c = Context({
            'attributes': self._render_attrs(attrs),
            'value': conditional_escape(force_unicode(value)),
            'id': attrs['id'],
            'options': options,
        })

        return t.render(c)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号