rodrigosantosbr

[Flask] CK-Editor in Flask-admin

Feb 11th, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
$ pip install flask-ckeditor

In your application:

from flask_ckeditor import CKEditor
app = Flask(__name__)
ckeditor = CKEditor(app)

Then in your view:

from flask_ckeditor import CKEditorField

class TestAdminView(ModelView):
    form_overrides = dict(text=CKEditorField)
    can_view_details = True
    create_template = 'edit.html'
    edit_template = 'edit.html'

In your template:

{% extends 'admin/model/edit.html' %}

{% block tail %}
    {{ super() }}
    {{ ckeditor.load() }}   
{% endblock %}
Add Comment
Please, Sign In to add comment