text editing with images

5 views
Skip to first unread message

yonatan braude

unread,
Feb 4, 2012, 3:02:39 PM2/4/12
to pywe...@googlegroups.com
hi, I am trying to implement a backend editing interface, I used django-tinymce. I used the 'tinymce.models.HTMLField' and in another try, I did (in 'admin.py'):
'''
formfield_overrides = {
        models.TextField:{
            'widget': TinyMCE(
                attrs={
                    'cols': 160, 
                    'rows': 20,
                    'theme': 'advanced',
                }, 
            )
        },
    }
'''
but in both case all I got was a very minimal editor (no image insert, witch is what I need) , any leads?

thanx
yonatan




Alex Arshavski

unread,
Feb 4, 2012, 5:00:33 PM2/4/12
to pywe...@googlegroups.com
Hi,

What you should do is to set all the buttons that you want to see (in settings.py). Something like:

TINYMCE_DEFAULT_CONFIG = {
    'plugins': "fullscreen,paste",
    'theme': "advanced",
    'theme_advanced_buttons1' : "bold,underline,italic,strikethrough,bullist,numlist,"\
                                "separator,undo,redo,separator,link,unlink,image"\
                                ",separator,cleanup,code,removeformat,charmap,"\
                                "fullscreen,pasteword,formatselect",
    'theme_advanced_buttons2' : "",
    'theme_advanced_buttons3' : "",
    'theme_advanced_toolbar_location': "top",
    'width' : '800px',
}

Pay attention to the image button that you need.
You can check all possible buttons here: http://www.tinymce.com/wiki.php/Buttons/controls
I use it together with formfield_overrides in admin.py like you wrote.

Hope it helps, Alex A.

--
You received this message because you are subscribed to the Google Groups "PyWeb-IL" group.
To post to this group, send email to pywe...@googlegroups.com.
To unsubscribe from this group, send email to pyweb-il+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyweb-il?hl=en.

yonatan braude

unread,
Feb 4, 2012, 5:17:47 PM2/4/12
to pywe...@googlegroups.com
I figerd it out! the 'theme: advanced' should be in another dict. in 'mce_attrs' not in 'attrs'. 
Reply all
Reply to author
Forward
0 new messages