Aidan Ewen
Aidan Ewen

Reputation: 13308

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

Upvotes: 1

Views: 771

Answers (2)

Aidan Ewen
Aidan Ewen

Reputation: 13308

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.

Upvotes: 1

WBAR
WBAR

Reputation: 4984

  1. Have You, Sir, done python manage.py collectstatic ?
  2. What value variable in settings.py is in TINYMCE_JS_ROOT and TINYMCE_JS_URL
  3. If variable TINYMCE_JS_URL is not set check if You, Sir, have file at /MEDIA_ROOT/js/tiny_mce/tiny_mce.js. If not, try to copy manually from django-tinymce's egg.

Upvotes: 1

Related Questions