Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
4ec0c470
Commit
4ec0c470
authored
Jun 29, 2015
by
Petrus J.v.Rensburg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor twaeks & typos.
parent
ed2bc787
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
adding_your_own_views.rst
doc/adding_your_own_views.rst
+2
-2
customising_builtin_views.rst
doc/customising_builtin_views.rst
+11
-5
No files found.
doc/adding_your_own_views.rst
View file @
4ec0c470
...
...
@@ -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
...
...
doc/customising_builtin_views.rst
View file @
4ec0c470
...
...
@@ -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'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment