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
0d248a8b
Unverified
Commit
0d248a8b
authored
Nov 12, 2017
by
Serge S. Koval
Committed by
GitHub
Nov 12, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1556 from nad2000/issues/1555
Use LEFT OUTER JOIN instead of INNER JOIN when searching rows
parents
a9f4a84a
edba5d60
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
7 deletions
+11
-7
.travis.yml
.travis.yml
+4
-0
view.py
flask_admin/contrib/peewee/view.py
+2
-2
tools.py
flask_admin/contrib/sqla/tools.py
+4
-4
tox.ini
tox.ini
+1
-1
No files found.
.travis.yml
View file @
0d248a8b
...
...
@@ -33,6 +33,10 @@ matrix:
addons
:
postgresql
:
"
9.4"
apt
:
packages
:
-
postgresql-9.4-postgis-2.4
-
postgresql-9.4-postgis-2.4-scripts
services
:
-
postgresql
...
...
flask_admin/contrib/peewee/view.py
View file @
0d248a8b
...
...
@@ -7,7 +7,7 @@ from flask_admin.babel import gettext, ngettext, lazy_gettext
from
flask_admin.model
import
BaseModelView
from
flask_admin.model.form
import
create_editable_list_form
from
peewee
import
PrimaryKeyField
,
ForeignKeyField
,
Field
,
CharField
,
TextField
from
peewee
import
JOIN
,
PrimaryKeyField
,
ForeignKeyField
,
Field
,
CharField
,
TextField
from
flask_admin.actions
import
action
from
flask_admin.contrib.peewee
import
filters
...
...
@@ -309,7 +309,7 @@ class ModelView(BaseModelView):
model_name
=
field
.
model_class
.
__name__
if
model_name
not
in
joins
:
query
=
query
.
join
(
field
.
model_class
)
query
=
query
.
join
(
field
.
model_class
,
JOIN
.
LEFT_OUTER
)
joins
.
add
(
model_name
)
return
query
...
...
flask_admin/contrib/sqla/tools.py
View file @
0d248a8b
...
...
@@ -75,14 +75,14 @@ def tuple_operator_in(model_pk, ids):
The returning operator can be used within a filter(), as it is just an or_ operator
"""
l
=
[]
ands
=
[]
for
id
in
ids
:
k
=
[]
for
i
in
range
(
len
(
model_pk
)):
k
.
append
(
eq
(
model_pk
[
i
],
id
[
i
]))
l
.
append
(
and_
(
*
k
))
if
len
(
l
)
>=
1
:
return
or_
(
*
l
)
ands
.
append
(
and_
(
*
k
))
if
len
(
ands
)
>=
1
:
return
or_
(
*
ands
)
else
:
return
None
...
...
tox.ini
View file @
0d248a8b
...
...
@@ -8,7 +8,7 @@ skip_missing_interpreters = true
[flake8]
max_line_length
=
120
ignore
=
E402
ignore
=
E402
,E722
[testenv]
usedevelop
=
true
...
...
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