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
435ebb36
Commit
435ebb36
authored
Feb 07, 2016
by
Paul Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify 'skip_checks' for column export macro
parent
9e0b7d71
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
23 deletions
+5
-23
base.py
flask_admin/model/base.py
+5
-23
No files found.
flask_admin/model/base.py
View file @
435ebb36
...
...
@@ -2015,34 +2015,16 @@ class BaseModelView(BaseView, ActionsMixin):
# Macros in column_formatters are not supported.
# Macros will have a function name 'inner'
# This causes non-macro functions named 'inner' not work.
# Skip this check when the field with the macro is excluded...
skip_checks
=
[]
if
self
.
column_export_exclude_list
:
skip_checks
.
extend
(
self
.
column_export_exclude_list
)
# or there is a macro-less column_formatters_export available.
for
col
,
func
in
iteritems
(
self
.
column_formatters_export
):
# we can skip checking columns not being exported
# when the export list is explicitly defined
if
self
.
column_export_list
and
\
col
not
in
self
.
column_export_list
:
skip_checks
.
append
(
col
)
continue
if
func
.
__name__
!=
'inner'
:
skip_checks
.
append
(
col
)
# main macro check loop, skipping the above "safe" skip list
for
col
,
func
in
iteritems
(
self
.
column_formatters
):
if
col
in
skip_checks
:
# skip checking columns not being exported
if
col
not
in
[
col
for
col
,
_
in
self
.
_export_columns
]:
continue
if
func
.
__name__
==
'inner'
:
raise
NotImplementedError
(
'Macros not implemented. Override with '
'column_formatters_export. Column:
%
s'
%
(
col
,)
'Macros are not implemented in export. Exclude column in'
' column_formatters_export, column_export_list, or '
' column_export_exclude_list. Column:
%
s'
%
(
col
,)
)
# Grab parameters from URL
...
...
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