From 60c5d31aa19bff04040594557f87e1f7aa205c48 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Fri, 26 Aug 2016 15:31:03 -0500 Subject: [PATCH] Allow opt-out for "download batch row data as CSV" feature Sometimes that just confuses the issue, e.g. when the batch provides a download feature of its own. --- tailbone/views/batch.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tailbone/views/batch.py b/tailbone/views/batch.py index 39a9a742..15faed2a 100644 --- a/tailbone/views/batch.py +++ b/tailbone/views/batch.py @@ -65,6 +65,7 @@ class BatchMasterView(MasterView): """ has_rows = True rows_deletable = True + rows_downloadable = True refreshable = True def __init__(self, request): @@ -712,11 +713,12 @@ class BatchMasterView(MasterView): "Execute {}".format(model_title)) # download rows as CSV - config.add_route('{}.csv'.format(route_prefix), '{}/{{uuid}}/csv'.format(url_prefix)) - config.add_view(cls, attr='csv', route_name='{}.csv'.format(route_prefix), - permission='{}.csv'.format(permission_prefix)) - config.add_tailbone_permission(permission_prefix, '{}.csv'.format(permission_prefix), - "Download {} rows as CSV".format(model_title)) + if cls.rows_downloadable: + config.add_route('{}.csv'.format(route_prefix), '{}/{{uuid}}/csv'.format(url_prefix)) + config.add_view(cls, attr='csv', route_name='{}.csv'.format(route_prefix), + permission='{}.csv'.format(permission_prefix)) + config.add_tailbone_permission(permission_prefix, '{}.csv'.format(permission_prefix), + "Download {} rows as CSV".format(model_title)) class FileBatchMasterView(BatchMasterView):