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 ...@@ -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 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 in place of the default `create`, `edit`, or `list` view. Then you can simply
override the view in question:: 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 from flask_admin.contrib.sqla import ModelView
......
...@@ -152,12 +152,16 @@ therefore should use a *SelectField*:: ...@@ -152,12 +152,16 @@ therefore should use a *SelectField*::
from wtforms.fields import SelectField from wtforms.fields import SelectField
class MyView(ModelView): class MyView(ModelView):
form_overrides = dict(status=SelectField) form_overrides = {
form_args = dict( 'status': SelectField
}
form_args = {
# Pass the choices to the `SelectField` # Pass the choices to the `SelectField`
status=dict( 'status': {
choices=[(0, 'waiting'), (1, 'in_progress'), (2, 'finished')] choices=[(0, 'waiting'), (1, 'in_progress'), (2, 'finished')]
)) }
}
It is relatively easy to add support for different database backends (Mongo, etc) by inheriting from 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 ...@@ -193,7 +197,9 @@ To handle complicated text content, use `CKEditor <http://ckeditor.com/>`_ by su
widget = CKTextAreaWidget() widget = CKTextAreaWidget()
class MessageAdmin(ModelView): class MessageAdmin(ModelView):
form_overrides = dict(body=wtf.FileField) form_overrides = {
'body': CKTextAreaField
}
create_template = 'ckeditor.html' create_template = 'ckeditor.html'
edit_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