[英]django-tinymce 1.5.2 no field to enter text
I create a blog and installed django-tinymce 1.5.2. 我创建了一个博客并安装了django-tinymce 1.5.2。 But when configured as mentioned documentation, I have no field to enter text in the admin panel.
但是,当按照上述文档进行配置时,我没有字段可在管理面板中输入文本。
My model 我的模特
class Post(models.Model):
DRAFT = "D"
PUBLISHED = "P"
POST_STATUS = (
(DRAFT, "Draft"),
(PUBLISHED, "Published"),
)
title = models.CharField(max_length=120)
text = HTMLField()
status = models.CharField(choices=POST_STATUS, default=DRAFT, max_length=10)
creation_date = models.DateTimeField(auto_now_add=True)
modification_date = models.DateTimeField(auto_now=True)
settings.py settings.py
INSTALLED_APPS = (
....
'suit',
'tinymce',
....
)
TINYMCE_JS_URL = os.path.join(STATIC_URL, 'tinymce/js/tinymce/tinymce.min.js')
TINYMCE_JS_ROOT = '/static/js/tiny_mce'
TINYMCE_DEFAULT_CONFIG = {
'plugins': "table,spellchecker,paste,searchreplace,print,textcolor",
'theme': "modern",
'cleanup_on_startup': True,
'custom_undo_redo_levels': 10,
}
TINYMCE_SPELLCHECKER = True
TINYMCE_COMPRESSOR = True
First, I would recommend testing that everything is installed correctly by following the instruction here . 首先,我建议您按照此处的说明测试所有组件是否正确安装。 I just tried it and everything worked accept the settings file was named "testtinymce.settings" not "testtinymce.staticfiles_settings."
我只是尝试了一下,一切正常,都接受了将设置文件命名为“ testtinymce.settings”而不是“ testtinymce.staticfiles_settings”。
You can see examples of the Admin code such as below (/site-packages/testtinymce/testapp/admin.py). 您可以查看下面的管理代码示例(/site-packages/testtinymce/testapp/admin.py)。
As for the 304 code - that just means the file has been cached locally and doesn't need to be retrieved again from the server. 至于304代码 -这仅意味着该文件已在本地缓存,无需再次从服务器检索。
def formfield_for_dbfield(self, db_field, **kwargs):
if db_field.name in ('content1', 'content2'):
return db_field.formfield(widget=TinyMCE(
attrs={'cols': 80, 'rows': 30},
mce_attrs={'external_link_list_url': reverse('tinymce.views.flatpages_link_list')},
))
return super(TinyMCETestInlineAdmin, self).formfield_for_dbfield(db_field, **kwargs)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.