我一直按照https://github.com/django-ckeditor/django-ckeditor上的说明进行操作,并擦除数据库以获取 RichTextField() 进行注册。我的models.py是:
#!/usr/bin/python
import settings
from ckeditor.fields import RichTextField
from django.db import models
class Page(models.Model):
title = models.CharField(max_length = 255)
body = RichTextField()
location = models.CharField(max_length = 255, verbose_name = "URL")
keywords = models.CharField(max_length = 255, blank = True)
meta_description = models.CharField(max_length = 255, blank = True)
script = models.TextField(blank = True)
def __unicode__(self):
return 'Page "' + self.title + '" at ' + self.location
class Meta:
ordering = ['title']
但是,ckeditor 没有出现在“body”字段中,并且查看管理页面编辑器的页面源代码表明没有对 ckeditor 的引用。
JavaScript 包含有:
<title>Add page | Django site admin</title>
<link rel="stylesheet" type="text/css" href="/static/admin/css/base.css" />
<link rel="stylesheet" type="text/css" href="/static/admin/css/forms.css" />
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="/static/admin/css/ie.css" /><![endif]-->
<script type="text/javascript">window.__admin_media_prefix__ = "/static/admin/";</script>
<script type="text/javascript" src="/admin/jsi18n/"></script>
<script type="text/javascript" src="/static/admin/js/core.js"></script>
<script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
<script type="text/javascript" src="/static/admin/js/actions.js"></script>
我可以/应该怎么做才能使“页面”的“正文”字段为其小部件提供 CKeditor?