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
0f0119ad
Commit
0f0119ad
authored
Sep 28, 2012
by
Sean Lynch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose to allow overriding in subclass ModelView
parent
56fc52b5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
view.py
flask_admin/contrib/sqlamodel/view.py
+9
-3
No files found.
flask_admin/contrib/sqlamodel/view.py
View file @
0f0119ad
...
...
@@ -451,6 +451,12 @@ class ModelView(BaseModelView):
return
joined
# Database-related API
def
get_query
(
self
):
"""
Return a query for the model type
"""
return
self
.
session
.
query
(
self
.
model
)
def
get_list
(
self
,
page
,
sort_column
,
sort_desc
,
search
,
filters
,
execute
=
True
):
"""
Return models from the database.
...
...
@@ -472,7 +478,7 @@ class ModelView(BaseModelView):
# Will contain names of joined tables to avoid duplicate joins
joins
=
set
()
query
=
self
.
session
.
query
(
self
.
model
)
query
=
self
.
get_query
(
)
# Apply search criteria
if
self
.
_search_supported
and
search
:
...
...
@@ -564,7 +570,7 @@ class ModelView(BaseModelView):
:param id:
Model id
"""
return
self
.
session
.
query
(
self
.
model
)
.
get
(
id
)
return
self
.
get_query
(
)
.
get
(
id
)
# Model handlers
def
create_model
(
self
,
form
):
...
...
@@ -637,7 +643,7 @@ class ModelView(BaseModelView):
try
:
model_pk
=
getattr
(
self
.
model
,
self
.
_primary_key
)
query
=
self
.
session
.
query
(
self
.
model
)
.
filter
(
model_pk
.
in_
(
ids
))
query
=
self
.
get_query
(
)
.
filter
(
model_pk
.
in_
(
ids
))
if
self
.
fast_mass_delete
:
count
=
query
.
delete
(
synchronize_session
=
False
)
...
...
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