Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

django admin TinyMCE integration

This is weird: I have installed and configured django-tinymce, but it doesn't seem to work with django admin.

this works fine with Safari:

class ArticleAdmin(admin.ModelAdmin):
    formfield_overrides = {
        models.TextField: {'widget': TinyMCE(attrs={'cols': 80, 'rows': 20}, )},
    }

but i does not work within firefox.

Just adding the js does not work with either:

class Media:
    js = ['/media/js/tiny_mce/tiny_mce.js']

I have tried various combinations of the path: with/without leading slash, with/without 'media' bit, even absolutely absolute http://localhost:8008/... Nothing worked for me.

Big fat however: using grappelli's own tinymce works in both firefox and safari (after adding safari into tinymce_config.js). Any idea what could go wrong?

Using Django 1.1, django-grappelli 2rc, django-tinymce 1.5, FF 3.5, Safari 4 on MacOS X 10.5

like image 299
Andy Avatar asked Dec 10 '09 18:12

Andy


3 Answers

The easiest would be to use something like django-tinymce

like image 164
armonge Avatar answered Oct 16 '22 15:10

armonge


The rigth path of js is 'js/tiny_mec/tiny_mce.js', by the way if are you running with the dev server, are you serving your static files with a web server?

like image 34
diegueus9 Avatar answered Oct 16 '22 14:10

diegueus9


here is solution of this

https://code.djangoproject.com/wiki/AddWYSIWYGEditor

it works :)

like image 24
Ahsan Avatar answered Oct 16 '22 16:10

Ahsan