-
Notifications
You must be signed in to change notification settings - Fork 227
Using django summernote in Django flatpages
Park Hyunwoo edited this page Apr 21, 2014
·
1 revision
Put below admin.py into your apps.
https://gist.github.com/lqez/11129362
from django.contrib.flatpages.models import FlatPage
from django_summernote.admin import SummernoteModelAdmin
class FlatPageAdmin(SummernoteModelAdmin):
pass
admin.site.unregister(FlatPage)
admin.site.register(FlatPage, FlatPageAdmin)
Or, https://gist.github.com/lqez/11129324
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 django_summernote.widgets import SummernoteWidget
class FlatpageForm(FlatpageFormOld):
content = forms.CharField(widget=SummernoteWidget())
class Meta:
model = FlatPage
class FlatPageAdmin(FlatPageAdminOld):
form = FlatpageForm
# We have to unregister the normal admin, and then reregister ours
admin.site.unregister(FlatPage)
admin.site.register(FlatPage, FlatPageAdmin)