第一级:必须下载office2013主题的CkEditor。
第二级:
模型.py
class Post(models.Model):
title = models.CharField(max_length=500, verbose_name=_('Title'), blank=True)
message = models.TextField(max_length=50000, verbose_name=_('Message'), blank=True)
管理员.py
class PostModelAdmin(admin.ModelAdmin):
formfield_overrides = { models.TextField: {'widget': forms.Textarea(attrs={'class':'ckeditor'})}, }
class Media:
js = ('ckeditor/ckeditor.js',) # The , at the end of this list IS important.
css = {
'all': ('ckeditor/contents.css',)
}
admin.site.register(Post, PostModelAdmin)