Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to integrate wysiwyg editor with django flatpages?

Tags:

django

How to integrate wysiwyg editor with django flatpages? I tryed django-ckeditor but it is not well described by. Has anyone tried it?

like image 941
user2069801 Avatar asked Feb 13 '13 22:02

user2069801


1 Answers

I just connect django-ckeditor to flatpages application by following code in admin.py:

from django.contrib import admin
from django.contrib.flatpages.admin import FlatPageAdmin
from django.contrib.flatpages.models import FlatPage
from django.db import models

from cked.widgets import CKEditorWidget

class FlatPageCustom(FlatPageAdmin):
    formfield_overrides = {
        models.TextField: {'widget': CKEditorWidget}
    }

admin.site.unregister(FlatPage)
admin.site.register(FlatPage, FlatPageCustom)

It works!

like image 128
Anatolij Avatar answered Oct 14 '22 08:10

Anatolij