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
df2aa6cd
Commit
df2aa6cd
authored
Jan 27, 2016
by
Tom Kedem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extracted the csv file name generation to a method for possible override.
parent
0f9f4b86
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
base.py
flask_admin/model/base.py
+9
-2
No files found.
flask_admin/model/base.py
View file @
df2aa6cd
...
@@ -1678,6 +1678,14 @@ class BaseModelView(BaseView, ActionsMixin):
...
@@ -1678,6 +1678,14 @@ class BaseModelView(BaseView, ActionsMixin):
self
.
column_type_formatters_export
,
self
.
column_type_formatters_export
,
)
)
def
get_export_name
(
self
):
"""
:return: The exported csv file name.
"""
filename
=
'
%
s_
%
s.csv'
%
(
self
.
name
,
time
.
strftime
(
"
%
Y-
%
m-
%
d_
%
H-
%
M-
%
S"
))
return
filename
# AJAX references
# AJAX references
def
_process_ajax_references
(
self
):
def
_process_ajax_references
(
self
):
"""
"""
...
@@ -2034,8 +2042,7 @@ class BaseModelView(BaseView, ActionsMixin):
...
@@ -2034,8 +2042,7 @@ class BaseModelView(BaseView, ActionsMixin):
for
c
in
self
.
_export_columns
]
for
c
in
self
.
_export_columns
]
yield
writer
.
writerow
(
vals
)
yield
writer
.
writerow
(
vals
)
filename
=
'
%
s_
%
s.csv'
%
(
self
.
name
,
filename
=
self
.
get_export_name
()
time
.
strftime
(
"
%
Y-
%
m-
%
d_
%
H-
%
M-
%
S"
))
disposition
=
'attachment;filename=
%
s'
%
(
secure_filename
(
filename
),)
disposition
=
'attachment;filename=
%
s'
%
(
secure_filename
(
filename
),)
...
...
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