开发者

Django: Problems embedding tinyMCE into my non-flatpage model

I got tinyMCE working for flat pages by copying the change_form.html file and embedding a script element.

I followed the directions here but still have issues. I added this snippet to my Entry model:

class Entry( models.Model ):

    class Admin:
        # various admin options are here
        js = (
                '/tiny_mce/tiny_mce.js',
                '/appmedia/admin/js/textareas.js',
            )

When I vie开发者_运维知识库w source in my add entry admin page ( after restarting Apache2 ) I don't see the above referenced js files anywhere.


The directions you linked to are very old, and in particular date back to before the 'newforms-admin' changes were made. You need to add the js tuple to your admin class's inner Media class, as described here.


Ended up resorting to django-tinymce, had to modify my app's admin.py and define a class for the AdminForm, override the form attribute with my newly created class, and tinyMCE finally showed up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜