diff --git a/tailbone/helpers.py b/tailbone/helpers.py index 46a30dec..14282c43 100644 --- a/tailbone/helpers.py +++ b/tailbone/helpers.py @@ -26,6 +26,7 @@ Template Context Helpers from __future__ import unicode_literals, absolute_import +import os import datetime from decimal import Decimal diff --git a/tailbone/templates/master/index.mako b/tailbone/templates/master/index.mako index 2c27d5a9..6ff9c4fe 100644 --- a/tailbone/templates/master/index.mako +++ b/tailbone/templates/master/index.mako @@ -143,6 +143,155 @@ <%def name="grid_tools()"> + ## download search results + % if master.results_downloadable and master.has_perm('download_results'): + % if use_buefy: + + Download Results + + + ${h.form(url('{}.download_results'.format(route_prefix)), ref='download_results_form')} + ${h.csrf_token(request)} + + + ${h.end_form()} + + +
+ +
+

+ There are + + {{ total.toLocaleString('en') }} ${model_title_plural} + + matching your current filters. +

+

+ You may download this set as a single data file if you like. +

+
+ + + Excel downloads for large data sets can take a long time to + generate, and bog down the server in the meantime. You are + encouraged to choose CSV for a large data set, even though + the end result (file size) may be larger with CSV. + + +
+ +
+ + + % for key, label in six.iteritems(master.download_results_supported_formats()): + + % endfor + + +
+ +
+
+

+ Will use DEFAULT fields. +

+

+ Will use ALL fields. +

+
+
+
+ + Use Default Fields + + + Use All Fields + + + Choose Fields + +
+
+ +
+
+ +
+
+
+ + + + + +
+
+

+ + < + +
+ + > + +
+
+ + + + + +
+
+
+ +
+ + +
+
+ % endif + % endif + ## merge 2 objects % if master.mergeable and request.has_perm('{}.merge'.format(permission_prefix)): @@ -256,6 +405,14 @@ <%def name="page_content()"> + + % if download_results_path: + + Your download should start automatically, or you can + ${h.link_to("click here", '{}?filename={}'.format(url('{}.download_results'.format(route_prefix)), h.os.path.basename(download_results_path)))} + + % endif + <${grid.component} :csrftoken="csrftoken" % if master.deletable and request.has_perm('{}.delete'.format(permission_prefix)) and master.delete_confirm == 'simple': @deleteActionClicked="deleteObject" @@ -295,6 +452,19 @@ ${parent.modify_this_page_vars()}