Search code examples
djangotinymcedjango-tinymce

Django-tinymce in Django Admin - "can't find variable: tinyMCE"


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..


Solution

  • 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.