Skip to content

Using flask-ckeditor with flask-admin inline model? #42

@jessesheidlower

Description

@jessesheidlower

I'm trying to use CKEditor in a Flask-Admin app, but where the field I need is in an inline model. In these cases, the Admin interface can generate any number of "add" forms, which will have id values like tablename-0-fieldname, tablename-1-fieldname, etc.

If I follow the general instructions for flask-admin integration, but set up my inline models in my ModelView subclass like:

inline_models = [(Quotation, dict(form_overrides=dict(bibliography=CKEditorField)))]

and then in my template:

{{ ckeditor.load() }}
{{ ckeditor.config(name='bibliography') }}

I end up with with a textarea that looks like:

<textarea class="ckeditor form-control" id="quotations-0-bibliography" name="quotations-0-bibliography"></textarea>

However, this does not cause a CKEditor instance to exist. I note that there is no <div id="cke_text"... that I see in the sample Flask-Admin app.

Is there a simple way to get this to work? Is there a not-simple way to get this to work?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions