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
1eb5c806
Commit
1eb5c806
authored
Aug 25, 2016
by
Tom Kedem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed hybrid property detection and made it robust.
parent
bd1a80b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
tools.py
flask_admin/contrib/sqla/tools.py
+5
-0
view.py
flask_admin/contrib/sqla/view.py
+1
-2
No files found.
flask_admin/contrib/sqla/tools.py
View file @
1eb5c806
...
...
@@ -2,6 +2,7 @@ from sqlalchemy import tuple_, or_, and_
from
sqlalchemy.sql.operators
import
eq
from
sqlalchemy.exc
import
DBAPIError
from
sqlalchemy.orm.attributes
import
InstrumentedAttribute
from
sqlalchemy_utils
import
get_hybrid_properties
from
flask_admin._compat
import
filter_list
,
string_types
from
flask_admin.tools
import
iterencode
,
iterdecode
,
escape
...
...
@@ -170,3 +171,7 @@ def get_field_with_path(model, name):
path
.
append
(
column
.
table
)
return
attr
,
path
def
is_hybrid_property
(
model
,
attr_name
):
return
attr_name
in
get_hybrid_properties
(
model
)
flask_admin/contrib/sqla/view.py
View file @
1eb5c806
...
...
@@ -2,7 +2,6 @@ import logging
import
warnings
import
inspect
from
sqlalchemy.ext.hybrid
import
HYBRID_PROPERTY
from
sqlalchemy.orm.attributes
import
InstrumentedAttribute
from
sqlalchemy.orm
import
joinedload
,
aliased
from
sqlalchemy.sql.expression
import
desc
...
...
@@ -604,7 +603,7 @@ class ModelView(BaseModelView):
return
filters
else
:
is_hybrid_property
=
hasattr
(
attr
,
'descriptor'
)
and
attr
.
descriptor
.
extension_type
==
HYBRID_PROPERTY
is_hybrid_property
=
tools
.
is_hybrid_property
(
self
.
model
,
name
)
if
is_hybrid_property
:
column
=
attr
else
:
...
...
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