Django Admin中的Django-tinymce - “找不到变量:tinyMCE” [英] Django-tinymce in Django Admin - "can't find variable: tinyMCE"

查看:210
本文介绍了Django Admin中的Django-tinymce - “找不到变量:tinyMCE”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用django-tinymce来编辑django管理员中的字段。



我的应用程序安装在我的virtualenv( Django的TinyMCE的== 1.5.1b4 )。它已在我安装的应用程序中列出 -

  INSTALLED_APPS =(
#...

'tinymce',

#...

我的设置包括以下

  TINYMCE_DEFAULT_CONFIG = {
'主题':高级,
'theme_advanced_toolbar_location ':top,
'theme_advanced_buttons1':bold,italic,underline,separator,
bullist,separator,outdent,indent,separator,undo,redo,
'theme_advanced_buttons2 ':,
'theme_advanced_buttons3':,
}

TINYMCE_SPELLCHECKER = True
TINYMCE_COMPRESSOR = True

我可以在 / MEDIA_ROOT / js / tiny_mce (默认值)



我的模型看起来像 - - / />

 从tinymce导入模型tinymce_models 

class MyModel(models.Model)

post = tinymce_models.HTMLField()

当我进入模型管理页面时,该字段显示为正常的文本字段,我的浏览器告诉我该字段的内联js脚本有一个错误。它表示它不能识别变量 tinyMCE 。它看起来不像页面甚至是加载js文件(我没有404的 - 我看不到任何加载的迹象)。



我不知道我失踪了..

解决方案

好的,看起来可能是一个bug django_tinymce代码。我已经恢复到1.5.1b2,一切都按预期工作。猜猜我应该考虑提交错误报告。


I'm trying to use django-tinymce to edit fields in django admin.

I've the app installed in my virtualenv (django-tinymce==1.5.1b4). It's listed in my installed apps -

INSTALLED_APPS = (
    #...

    'tinymce',

    #...
)

My settings includes the following

TINYMCE_DEFAULT_CONFIG = {
'theme': "advanced",
'theme_advanced_toolbar_location': "top",
'theme_advanced_buttons1': "bold,italic,underline,separator,"
    "bullist,separator,outdent,indent,separator,undo,redo",
'theme_advanced_buttons2': "",
'theme_advanced_buttons3': "",
}

TINYMCE_SPELLCHECKER = True
TINYMCE_COMPRESSOR = True

And I've got the files available at /MEDIA_ROOT/js/tiny_mce (the default).

My models look like -

from tinymce import models as tinymce_models

class MyModel(models.Model)

    post = tinymce_models.HTMLField()

When I go to the model admin page, the field appears as a normal text field and my browser tells me there's an error on the inline js script for the field. It says it doesn't recognise the variable tinyMCE. It doesn't look like the page is even trying to load the js file (I'm getting no 404's - I can't see any sign of anything being loaded).

I'm not sure what I'm missing..

解决方案

OK, looks like it might have been a bug in the django_tinymce code. I've reverted to 1.5.1b2 and everything works as expected. Guess I should look into filing a bug report.

这篇关于Django Admin中的Django-tinymce - “找不到变量:tinyMCE”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆