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
e4c04cbe
Commit
e4c04cbe
authored
Jul 25, 2015
by
Priit Laes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve various docstrings in SQLAlchemy model code
parent
acf87cba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
view.py
flask_admin/contrib/sqla/view.py
+15
-15
No files found.
flask_admin/contrib/sqla/view.py
View file @
e4c04cbe
...
@@ -96,19 +96,19 @@ class ModelView(BaseModelView):
...
@@ -96,19 +96,19 @@ class ModelView(BaseModelView):
The following search rules apply:
The following search rules apply:
- If you enter
*ZZZ* in the UI search field, it will generate *ILIKE '
%
ZZZ
%
'*
- If you enter
``ZZZ`` in the UI search field, it will generate ``ILIKE '
%
ZZZ
%
'``
statement against searchable columns.
statement against searchable columns.
- If you enter multiple words, each word will be searched separately, but
- If you enter multiple words, each word will be searched separately, but
only rows that contain all words will be displayed. For example, searching
only rows that contain all words will be displayed. For example, searching
for
'abc def' will find all rows that contain 'abc' and 'def'
in one or
for
``abc def`` will find all rows that contain ``abc`` and ``def``
in one or
more columns.
more columns.
- If you prefix your search term with
^
, it will find all rows
- If you prefix your search term with
``^``
, it will find all rows
that start with
^. So, if you entered *^ZZZ*, *ILIKE 'ZZZ
%
'*
will be used.
that start with
``^``. So, if you entered ``^ZZZ`` then ``ILIKE 'ZZZ
%
'``
will be used.
- If you prefix your search term with
=
, it will perform an exact match.
- If you prefix your search term with
``=``
, it will perform an exact match.
For example, if you entered
*=ZZZ*, the statement *ILIKE 'ZZZ'*
will be used.
For example, if you entered
``=ZZZ``, the statement ``ILIKE 'ZZZ'``
will be used.
"""
"""
column_filters
=
None
column_filters
=
None
...
@@ -170,9 +170,9 @@ class ModelView(BaseModelView):
...
@@ -170,9 +170,9 @@ class ModelView(BaseModelView):
giving SQLAlchemy a chance to manually cleanup any dependencies (many-to-many
giving SQLAlchemy a chance to manually cleanup any dependencies (many-to-many
relationships, etc).
relationships, etc).
If set to `True`, will run a `
DELETE
` statement which is somewhat faster,
If set to `True`, will run a `
`DELETE`
` statement which is somewhat faster,
but may leave corrupted data if you forget to configure `DELETE
but may leave corrupted data if you forget to configure `
`
DELETE
CASCADE` for your model.
CASCADE`
`
for your model.
"""
"""
inline_models
=
None
inline_models
=
None
...
@@ -201,12 +201,12 @@ class ModelView(BaseModelView):
...
@@ -201,12 +201,12 @@ class ModelView(BaseModelView):
You can customize the generated field name by:
You can customize the generated field name by:
1. Using the `form_name` property as a key to the options dictionary:
1. Using the `form_name` property as a key to the options dictionary:
:
class MyModelView(ModelView):
class MyModelView(ModelView):
inline_models = ((Post, dict(form_label='Hello')))
inline_models = ((Post, dict(form_label='Hello')))
2. Using forward relation name and `column_labels` property:
2. Using forward relation name and `column_labels` property:
:
class Model1(Base):
class Model1(Base):
pass
pass
...
@@ -231,7 +231,7 @@ class ModelView(BaseModelView):
...
@@ -231,7 +231,7 @@ class ModelView(BaseModelView):
class MyModelView(BaseModelView):
class MyModelView(BaseModelView):
form_choices = {'my_form_field': [
form_choices = {'my_form_field': [
('db_value', 'display_value'),
('db_value', 'display_value'),
]
]
}
"""
"""
form_optional_types
=
(
Boolean
,)
form_optional_types
=
(
Boolean
,)
...
@@ -732,10 +732,10 @@ class ModelView(BaseModelView):
...
@@ -732,10 +732,10 @@ class ModelView(BaseModelView):
"""
"""
Return a the count query for the model type
Return a the count query for the model type
A
query(self.model).count()
approach produces an excessive
A
``query(self.model).count()``
approach produces an excessive
subquery, so
query(func.count('*'))
should be used instead.
subquery, so
``query(func.count('*'))``
should be used instead.
See
#45a2723 commit message
for details.
See
commit ``#45a2723``
for details.
"""
"""
return
self
.
session
.
query
(
func
.
count
(
'*'
))
.
select_from
(
self
.
model
)
return
self
.
session
.
query
(
func
.
count
(
'*'
))
.
select_from
(
self
.
model
)
...
...
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