From 2dc539c3573c45c5d9eee58d8562830d5ba96db3 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Tue, 8 Aug 2017 16:57:05 -0500 Subject: [PATCH] Fix bulk-delete for batch rows, allow it for pricing batches --- tailbone/views/batch/core.py | 2 +- tailbone/views/batch/pricing.py | 3 ++- tailbone/views/master.py | 13 +++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tailbone/views/batch/core.py b/tailbone/views/batch/core.py index a3a9891d..d0ec1245 100644 --- a/tailbone/views/batch/core.py +++ b/tailbone/views/batch/core.py @@ -740,7 +740,7 @@ class BatchMasterView(MasterView): "Delete" all rows matching the current row grid view query. This sets the ``removed`` flag on the rows but does not truly delete them. """ - query = self.get_effective_row_query() + query = self.get_effective_row_data(sort=False) query.update({'removed': True}, synchronize_session=False) return self.redirect(self.get_action_url('view', self.get_instance())) diff --git a/tailbone/views/batch/pricing.py b/tailbone/views/batch/pricing.py index 729aa6a8..f35ba04a 100644 --- a/tailbone/views/batch/pricing.py +++ b/tailbone/views/batch/pricing.py @@ -43,8 +43,9 @@ class PricingBatchView(BatchMasterView): route_prefix = 'batch.pricing' url_prefix = '/batches/pricing' creatable = False - rows_editable = True bulk_deletable = True + rows_editable = True + rows_bulk_deletable = True grid_columns = [ 'id', diff --git a/tailbone/views/master.py b/tailbone/views/master.py index 4189b551..75ff6e3c 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -570,6 +570,19 @@ class MasterView(View): """ raise NotImplementedError + def get_effective_row_data(self, session=None, sort=False, **kwargs): + """ + Convenience method which returns the "effective" data for the row grid, + filtered (and optionally sorted) to match what would show on the UI, + but not paged. + """ + if session is None: + session = self.Session() + kwargs.setdefault('pageable', False) + kwargs.setdefault('sortable', sort) + grid = self.make_row_grid(session=session, **kwargs) + return grid.make_visible_data() + @classmethod def get_row_route_prefix(cls): """