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)
评论列表
文章目录