django + tinymce problems

71 views
Skip to first unread message

sri

unread,
Oct 28, 2012, 5:44:04 PM10/28/12
to django...@googlegroups.com
Hi,

I have tried using tinymce in my sample django application, but i am not getting the tinymce editor in my admin pages.

I am trying to setup tinymce to use in admin pages and using Django 1.4

This is how my settings.py file looks like

   MEDIA_ROOT = ' '
   MEDIA_URL = ' '
   STATIC_ROOT = ' '
   STATIC_URL = '/static/'
   TINYMCE_JS_URL = os.path.join(PROJECT_ROOT, "static/js/tiny_mce/tiny_mce.js")
   TINYMCE_DEFAULT_CONFIG = {
       'plugins': "table,spellchecker,paste,searchreplace",
       'theme': "advanced",
       'cleanup_on_startup': True,
       'custom_undo_redo_levels': 10,
   }
   TINYMCE_SPELLCHECKER = True
   TINYMCE_COMPRESSOR = True


And in my app, the models.py file looks like below

    class place(models.Model):
        place_description = models.TextField(max_length=5000)

And my admin.py field looks like below:

    class PlaceDetailsAdmin(admin.ModelAdmin):
                class Media:
                       js = ('/Users/Sreekanth/django_demo/godjango/sample/sample/static/js/tiny_mce/tiny_mce.js',
                              '/Users/Sreekanth/django_demo/godjango/sample/sample/static/js/textareas.js'
                       )

And the tiny_mce is stored in the /static/js/ folder inside my project.

With the above settings, when i login to admin, i can not see any tinymce editor for place_description field.

Could someone please let me know what i am missing?

Thanks
Sreekanth

Tom Evans

unread,
Oct 29, 2012, 7:12:51 AM10/29/12
to django...@googlegroups.com
Paths in the Media class should be relative to your static URL, not
absolute file locations.

https://docs.djangoproject.com/en/1.4/ref/contrib/admin/#modeladmin-media-definitions
https://docs.djangoproject.com/en/1.4/topics/forms/media/#form-media-paths

Cheers

Tom

sri

unread,
Oct 29, 2012, 6:05:22 PM10/29/12
to django...@googlegroups.com, teva...@googlemail.com
Thanks for the reply Tom.

It worked after changing to relative paths.

Sreekanth
Reply all
Reply to author
Forward
0 new messages