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
a4dac05a
Commit
a4dac05a
authored
May 30, 2012
by
Priit Laes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve formatting and some minor text improvements
parent
0050893d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
19 deletions
+20
-19
base.py
flask_admin/model/base.py
+20
-19
No files found.
flask_admin/model/base.py
View file @
a4dac05a
...
@@ -93,8 +93,8 @@ class BaseModelView(BaseView):
...
@@ -93,8 +93,8 @@ class BaseModelView(BaseView):
class MyModelView(BaseModelView):
class MyModelView(BaseModelView):
sortable_columns = ('name', ('user', 'user.username'))
sortable_columns = ('name', ('user', 'user.username'))
For SQLAlchemy models, you can pass attribute instead of the string
When using SQLAlchemy models, model attributes can be used instead
too
::
of the string
::
class MyModelView(BaseModelView):
class MyModelView(BaseModelView):
sortable_columns = ('name', ('user', User.username))
sortable_columns = ('name', ('user', User.username))
...
@@ -106,7 +106,7 @@ class BaseModelView(BaseView):
...
@@ -106,7 +106,7 @@ class BaseModelView(BaseView):
text-only fields are searchable, but it is up for a model
text-only fields are searchable, but it is up for a model
implementation to make decision.
implementation to make decision.
For e
xample::
E
xample::
class MyModelView(BaseModelView):
class MyModelView(BaseModelView):
searchable_columns = ('name', 'email')
searchable_columns = ('name', 'email')
...
@@ -118,7 +118,7 @@ class BaseModelView(BaseView):
...
@@ -118,7 +118,7 @@ class BaseModelView(BaseView):
Can contain either field names or instances of :class:`~flask.ext.admin.model.filters.BaseFilter` classes.
Can contain either field names or instances of :class:`~flask.ext.admin.model.filters.BaseFilter` classes.
For example
:
Example:
:
class MyModelView(BaseModelView):
class MyModelView(BaseModelView):
column_filters = ('user', 'email')
column_filters = ('user', 'email')
...
@@ -128,7 +128,7 @@ class BaseModelView(BaseView):
...
@@ -128,7 +128,7 @@ class BaseModelView(BaseView):
"""
"""
Form class. Override if you want to use custom form for your model.
Form class. Override if you want to use custom form for your model.
For example:
For example:
:
class MyForm(wtf.Form):
class MyForm(wtf.Form):
pass
pass
...
@@ -137,12 +137,26 @@ class BaseModelView(BaseView):
...
@@ -137,12 +137,26 @@ class BaseModelView(BaseView):
form = MyForm
form = MyForm
"""
"""
form_args
=
None
"""
Dictionary of form field arguments. Refer to WTForms documentation for
list of possible options.
Example::
class MyModelView(BaseModelView):
form_args = dict(
name=dict(label='First Name', validators=[wtf.required()])
)
"""
form_columns
=
None
form_columns
=
None
"""
"""
Collection of the model field names for the form. If set to `None` will
Collection of the model field names for the form. If set to `None` will
get them from the model.
get them from the model.
For example
:
Example:
:
class MyModelView(BaseModelView):
class MyModelView(BaseModelView):
list_columns = ('name', 'email')
list_columns = ('name', 'email')
...
@@ -158,19 +172,6 @@ class BaseModelView(BaseView):
...
@@ -158,19 +172,6 @@ class BaseModelView(BaseView):
excluded_form_columns = ('last_name', 'email')
excluded_form_columns = ('last_name', 'email')
"""
"""
form_args
=
None
"""
Dictionary of form field arguments. Refer to WTForm documentation for
list of possible options.
Example::
class MyModelView(BaseModelView):
form_args = dict(
name=dict(label='First Name', validators=[wtf.required()])
)
"""
form_overrides
=
None
form_overrides
=
None
"""
"""
Dictionary of form column overrides.
Dictionary of form column overrides.
...
...
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