Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to use django-wysiwyg-redactor with django-admin-bootstrapped
from django.db import models
from django.contrib import admin
from redactor.widgets import RedactorEditor
class BsRedactorEditor(RedactorEditor):
def __init__(self, *args, **kwargs):
super(BsRedactorEditor, self).__init__(*args, **kwargs)
self.Media.js = (
'redactor/redactor.js',
)
class SomeModelAdmin(admin.ModelAdmin):
# your model definition here
formfield_overrides = {
models.TextField: {'widget': BsRedactorEditor},
}
admin.site.register(SomeModelAdmin)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment