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
ba84a1af
Commit
ba84a1af
authored
Jan 31, 2013
by
Christopher Toth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor English cleanups for flask_admin.contrib.sqlamodel.view
parent
208adeab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
22 deletions
+22
-22
view.py
flask_admin/contrib/sqlamodel/view.py
+22
-22
No files found.
flask_admin/contrib/sqlamodel/view.py
View file @
ba84a1af
...
...
@@ -18,7 +18,7 @@ from .typefmt import DEFAULT_FORMATTERS
class
ModelView
(
BaseModelView
):
"""
SQLA
L
chemy model view
SQLA
l
chemy model view
Usage sample::
...
...
@@ -90,7 +90,7 @@ class ModelView(BaseModelView):
class MyModelView(ModelView):
column_searchable_list = (User.name, User.email)
F
ollowing search rules apply:
The f
ollowing search rules apply:
- If you enter *ZZZ* in the UI search field, it will generate *ILIKE '
%
ZZZ
%
'*
statement against searchable columns.
...
...
@@ -103,8 +103,8 @@ class ModelView(BaseModelView):
- 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.
- If you prefix your search term with =, it will
do
exact match.
For example, if you entered *=ZZZ*,
*ILIKE 'ZZZ'* statement
will be used.
- 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.
"""
column_filters
=
None
...
...
@@ -163,11 +163,11 @@ class ModelView(BaseModelView):
"""
If set to `False` and user deletes more than one model using built in action,
all models will be read from the database and then deleted one by one
giving SQLAlchemy chance to manually cleanup any dependencies (many-to-many
giving SQLAlchemy
a
chance to manually cleanup any dependencies (many-to-many
relationships, etc).
If set to `True`, will run `DELETE` statement which is somewhat faster,
but m
ight
leave corrupted data if you forget to configure `DELETE
If set to `True`, will run
a
`DELETE` statement which is somewhat faster,
but m
ay
leave corrupted data if you forget to configure `DELETE
CASCADE` for your model.
"""
...
...
@@ -195,9 +195,9 @@ class ModelView(BaseModelView):
class MyModelView(ModelView):
inline_models = (MyInlineModelForm(MyInlineModel),)
You can customize generated field name by:
You can customize
the
generated field name by:
1. Using
`form_name` property as option
:
1. Using
the `form_name` property as a key to the options dictionary
:
class MyModelView(ModelView):
inline_models = ((Post, dict(form_label='Hello')))
...
...
@@ -226,15 +226,15 @@ class ModelView(BaseModelView):
:param model:
Model class
:param session:
SQLA
L
chemy session
SQLA
l
chemy session
:param name:
View name. If not set,
will default to
model name
View name. If not set,
defaults to the
model name
:param category:
Category name
:param endpoint:
Endpoint name. If not set,
will default to
model name
Endpoint name. If not set,
defaults to the
model name
:param url:
Base URL. If not set,
will default
to '/admin/' + endpoint
Base URL. If not set,
defaults
to '/admin/' + endpoint
"""
self
.
session
=
session
...
...
@@ -270,19 +270,19 @@ class ModelView(BaseModelView):
# Scaffolding
def
scaffold_pk
(
self
):
"""
Return primary key name from a model
Return
the
primary key name from a model
"""
return
tools
.
get_primary_key
(
self
.
model
)
def
get_pk_value
(
self
,
model
):
"""
Return PK value from a model object.
Return
the
PK value from a model object.
"""
return
getattr
(
model
,
self
.
_primary_key
)
def
scaffold_list_columns
(
self
):
"""
Return list of columns from the model.
Return
a
list of columns from the model.
"""
columns
=
[]
...
...
@@ -307,7 +307,7 @@ class ModelView(BaseModelView):
def
scaffold_sortable_columns
(
self
):
"""
Return dictionary of sortable columns.
Return
a
dictionary of sortable columns.
Key is column name, value is sort column/field.
"""
columns
=
dict
()
...
...
@@ -322,7 +322,7 @@ class ModelView(BaseModelView):
column
=
p
.
columns
[
0
]
# Can't sort
by on primary and
foreign keys by default
# Can't sort
on primary or
foreign keys by default
if
column
.
foreign_keys
:
continue
...
...
@@ -383,7 +383,7 @@ class ModelView(BaseModelView):
def
is_text_column_type
(
self
,
name
):
"""
Verify if column type is text-based.
Verify if
the provided
column type is text-based.
:returns:
``True`` for ``String``, ``Unicode``, ``Text``, ``UnicodeText``
...
...
@@ -479,7 +479,7 @@ class ModelView(BaseModelView):
def
is_valid_filter
(
self
,
filter
):
"""
Verify that provided filter object is derived from the
Verify that
the
provided filter object is derived from the
SQLAlchemy-compatible filter class.
:param filter:
...
...
@@ -522,7 +522,7 @@ class ModelView(BaseModelView):
def
scaffold_auto_joins
(
self
):
"""
Return list of joined tables by going through the
Return
a
list of joined tables by going through the
displayed columns.
"""
if
not
self
.
column_auto_select_related
:
...
...
@@ -669,7 +669,7 @@ class ModelView(BaseModelView):
def
get_one
(
self
,
id
):
"""
Return
on
e model by its id.
Return
a singl
e model by its id.
:param id:
Model id
...
...
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