-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using flask-ckeditor with flask-admin inline model? #42
Comments
Hi, thanks for reporting on this. I'm not familiar with Flask-Admin, please add an minimal, complete, and verifiable example, then I can run and test with it. |
Oh, it was your comment in the Flask-Admin docs that got me here in the first place! And there are two Flask-Admin examples in the examples directory here. In any case: I have an MCVE that is a small modification of the "flask-admin" example in this repo. This example takes the "Post" class and adds a one-to-many "Comment" to it, and then adds Comment as an inline model to the Post class. The goal is for the text field in the Comment to have a CKEditor instance. To run this, use the "flask-admin" example, replacing Thank you so much for looking this over. app.py:
new test_create.html template:
|
Since the |
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 liketablename-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?
The text was updated successfully, but these errors were encountered: