我想要覆盖TinyMCE的渲染方法 我想出于某种原因使用TinyMCE旁边的按钮, 我写了几行,但没有效果:
这是我的班级:
class UpdateTinyMCE(TinyMCE):
def render(self, *args, **kwargs):
html = super(UpdateTinyMCE, self).render(*args, **kwargs)
return mark_safe(html + '<input type="button" value="submit" />')
这是用法:
class ArticleForm(ModelForm):
class Meta:
model = Article
exclude = ['slug', 'rating', 'numberOfRates', 'isCommentApproval', 'maximumRate']
widgets = {
'renderType': Select(attrs={'onChange': 'changeRenderType();' }),
'content':UpdateTinyMCE(attrs={'cols': 100, 'rows': 30})
}