Skip to content

Commit 2af915b

Browse files
committed
Update tips for configration registeration of flask-admin
1 parent 16b3206 commit 2af915b

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

docs/configuration.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ When using Flask-WTF/WTForms, you have to pass the field name as ``name`` in ``c
2424
{{ ckeditor.config(name='description') }}
2525
</body>
2626

27-
When using Flask-Admin, the default form field name is ``text``, so normally you will use this:
27+
When using Flask-Admin, the name value will be the field name you overwritten with ``form_overrides = dict(the_field_name=CKEditorField)``.
28+
For example:
2829

2930
.. code-block:: jinja
3031

31-
<body>
32+
{% extends 'admin/model/edit.html' %}
33+
34+
{% block tail %}
35+
{{ super() }}
3236
... <!-- {{ ckeditor.load() }} or <script src="/path/to/ckeditor.js"> -->
33-
{{ ckeditor.config(name='text') }}
34-
</body>
37+
{{ ckeditor.config(name='the_field_name') }}
38+
{% endblock %}
3539

3640
If you create the CKEditor through ``ckeditor.create()``, the default value (``name='ckeditor'``) will be used.
3741

examples/flask-admin-upload/templates/edit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
{% block tail %}
44
{{ super() }}
55
{{ ckeditor.load() }}
6-
{# the name value must be 'text' #}
6+
{# The name value should be the name of the CKEditor form field, here is `text`. #}
77
{{ ckeditor.config(name='text') }}
88
{% endblock %}

examples/flask-admin/templates/edit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{#
77
if you have set the configuration variables more than CKEDITOR_SERVE_LOCAL and CKEDITOR_PKG_TYPE,
88
or you need to config the CKEditor textarea, use the line below to register the configuration.
9-
The name value should be the name of the CKEditor form field, it defaults to "text" in Flask-Admin.
9+
The name value should be the name of the CKEditor form field.
1010
#}
1111
{{ ckeditor.config(name='text') }}
1212
{% endblock %}

0 commit comments

Comments
 (0)