pythondjangodjango-adminwysiwygdjango-tinymce

django-tinymce to work on all textareas in django admin


I have been trying to get tiny mce to work for my django admin site on all textareas without having to add each field's widget. I have a lot of forms and would like this to work as "automagically" as possible.

I have installed tiny mce using the "pip install django-tinymce" method.

I have followed the following article and even though it does not throw any errors in firebug or developer mode I cannot see what I am doing wrong.

https://blog.bixly.com/django-tinymce-in-djangos-admin-app

I have followed this to a the letter with no luck at all. Any thoughts or suggestions to get this working on all textareas would be greatly appreciated.

Thanks,

jAC


Solution

  • I was able to get this to work by using admin.py's ModelAdmin classes.

    For example:

    @admin.register(HomePageSlider)
    class HomePageSliderAdmin(admin.ModelAdmin):
        class Media:
            js = ( '/static/assets/js/tiny_mce/tiny_mce.js' , '/static/assets/js/tiny_mce/textareas.js' )
    

    The first part is for the tinymce location and the second is loading the configuration that i threw in a textareas.js file.