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
46482cd1
Unverified
Commit
46482cd1
authored
Jan 10, 2020
by
Leon van Wissen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: association proxy results in form_ajax_refs
Builds upon #1906
parent
69a69847
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 @
46482cd1
...
...
@@ -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 @
46482cd1
...
...
@@ -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