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
630cf0e0
Commit
630cf0e0
authored
Jun 14, 2016
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #1299 - allow virtual columns with formatters.
parent
f054519a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
9 deletions
+15
-9
view.py
flask_admin/contrib/sqla/view.py
+15
-9
No files found.
flask_admin/contrib/sqla/view.py
View file @
630cf0e0
...
...
@@ -514,17 +514,23 @@ class ModelView(BaseModelView):
formatted_columns
=
[]
for
c
in
only_columns
:
column
,
path
=
tools
.
get_field_with_path
(
self
.
model
,
c
)
try
:
column
,
path
=
tools
.
get_field_with_path
(
self
.
model
,
c
)
if
path
:
# column is a relation (InstrumentedAttribute), use full path
column_name
=
text_type
(
c
)
else
:
# column is in same table, use only model attribute name
if
getattr
(
column
,
'key'
,
None
)
is
not
None
:
column_name
=
column
.
key
else
:
if
path
:
# column is a relation (InstrumentedAttribute), use full path
column_name
=
text_type
(
c
)
else
:
# column is in same table, use only model attribute name
if
getattr
(
column
,
'key'
,
None
)
is
not
None
:
column_name
=
column
.
key
else
:
column_name
=
text_type
(
c
)
except
AttributeError
:
# TODO: See ticket #1299 - allow virtual columns. Probably figure out
# better way to handle it. For now just assume if column was not found - it
# is virtual and there's column formatter for it.
column_name
=
text_type
(
c
)
visible_name
=
self
.
get_column_name
(
column_name
)
...
...
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