Commit 4ec0c470 authored by Petrus J.v.Rensburg's avatar Petrus J.v.Rensburg

Minor twaeks & typos.

parent ed2bc787
......@@ -37,8 +37,8 @@ Overriding the builtin views
------------------------------------
If you want most of the builtin ModelView functionality, but you want to have your own view
in place of the default `create`, `edit`, or `list` view. Then you can simply override
override the view in question::
in place of the default `create`, `edit`, or `list` view. Then you can simply
override the view in question, and all the links to it will still function as you would expect::
from flask_admin.contrib.sqla import ModelView
......
......@@ -152,12 +152,16 @@ therefore should use a *SelectField*::
from wtforms.fields import SelectField
class MyView(ModelView):
form_overrides = dict(status=SelectField)
form_args = dict(
form_overrides = {
'status': SelectField
}
form_args = {
# Pass the choices to the `SelectField`
status=dict(
'status': {
choices=[(0, 'waiting'), (1, 'in_progress'), (2, 'finished')]
))
}
}
It is relatively easy to add support for different database backends (Mongo, etc) by inheriting from
......@@ -193,7 +197,9 @@ To handle complicated text content, use `CKEditor <http://ckeditor.com/>`_ by su
widget = CKTextAreaWidget()
class MessageAdmin(ModelView):
form_overrides = dict(body=wtf.FileField)
form_overrides = {
'body': CKTextAreaField
}
create_template = 'ckeditor.html'
edit_template = 'ckeditor.html'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment