abyx
abyx

Reputation: 72888

django-wysiwyg: Use YUI SimpleEditor instead of the default Editor

I'm using django-wysiwyg in my django app, and by default it makes use of YUI's Editor. I'd rather it to use the SimpleEditor, because it's, well, simpler.

Is there an easy way of doing this that doesn't require forking the project? :)

Upvotes: 0

Views: 503

Answers (2)

abyx
abyx

Reputation: 72888

I ended up creating a django_wysiwyg directory under my templates directory, and under it placed:

- simple_yui
    - includes.html
    - editor_instance.html

Where editor_instance.html simply extends the default one and includes.html is a copy of the default one with SimpleEditor instead of Editor. Then I just had to add to my settings:

DJANGO_WYSIWYG_FLAVOR = 'simple_yui'

And that what that. Not very clean, but did the trick

Upvotes: 0

peterp
peterp

Reputation: 3165

You could always just define a Media class in the appropriate class on your admin.py file which includes Javascript to support the WYSIWYG editor.

from django.contrib import admin
from models import MyModel

class MyModelAdmin(admin.ModelAdmin):
    class Media:
         js = [
              '/path/to/static/js/that/includes/wysiwyg.js',
              '/path/to/static/js/that/replaces/textarea/with/wysiwyg.js',
         ]

admin.site.register(MyModel, MyModelAdmin)

Upvotes: 0

Related Questions