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
72534607
Unverified
Commit
72534607
authored
Jan 11, 2020
by
Serge S. Koval
Committed by
GitHub
Jan 11, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1947 from LvanWissen/associationproxy
Fix for loading association proxy results
parents
69a69847
ff8ebd2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
ajax.py
flask_admin/contrib/sqla/ajax.py
+3
-1
tools.py
flask_admin/contrib/sqla/tools.py
+2
-0
No files found.
flask_admin/contrib/sqla/ajax.py
View file @
72534607
...
...
@@ -69,7 +69,9 @@ class QueryAjaxModelLoader(AjaxModelLoader):
def
get_list
(
self
,
term
,
offset
=
0
,
limit
=
DEFAULT_PAGE_SIZE
):
query
=
self
.
get_query
()
filters
=
(
cast
(
field
,
String
)
.
ilike
(
u'
%%%
s
%%
'
%
term
)
for
field
in
self
.
_cached_fields
)
# no type casting to string if a ColumnAssociationProxyInstance is given
filters
=
(
field
.
ilike
(
u'
%%%
s
%%
'
%
term
)
if
is_association_proxy
(
field
)
else
cast
(
field
,
String
)
.
ilike
(
u'
%%%
s
%%
'
%
term
)
for
field
in
self
.
_cached_fields
)
query
=
query
.
filter
(
or_
(
*
filters
))
if
self
.
filters
:
...
...
flask_admin/contrib/sqla/tools.py
View file @
72534607
...
...
@@ -216,4 +216,6 @@ def is_relationship(attr):
def
is_association_proxy
(
attr
):
if
hasattr
(
attr
,
'parent'
):
attr
=
attr
.
parent
return
hasattr
(
attr
,
'extension_type'
)
and
attr
.
extension_type
==
ASSOCIATION_PROXY
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