Created
March 31, 2015 18:04
-
-
Save malgorath/fafc1c6d7a4439fe9e2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from django.contrib.flatpages.models import FlatPage | |
# Note: we are renaming the original Admin and Form as we import them! | |
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld | |
from django.contrib.flatpages.admin import FlatpageForm as FlatpageFormOld | |
from django import forms | |
from ckeditor.widgets import CKEditorWidget | |
class FlatpageForm(FlatpageFormOld): | |
content = forms.CharField(widget=CKEditorWidget()) | |
class Meta: | |
model = FlatPage # this is not automatically inherited from FlatpageFormOld | |
class FlatPageAdmin(FlatPageAdminOld): | |
form = FlatpageForm | |
# We have to un-register the normal admin, and then re-register ours | |
admin.site.unregister(FlatPage) | |
admin.site.register(FlatPage, FlatPageAdmin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ckeditor is in INSTALLED_APPS
settings.py ckeditor settings:
CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_IMAGE_BACKEND = "pillow"
CKEDITOR_CONFIGS = {
'default': {
'toolbar': 'UltraFull',
},
}
CKEDITOR_JQUERY_URL = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'