From 12545c6a204fd9f10b932181efb97b052297da55 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 30 Jan 2017 17:08:05 -0600 Subject: [PATCH] Add way for batch views to hide rows with given status code(s) This seems like it would often be useful...though maybe belongs in the handler? --- tailbone/views/batch/core.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tailbone/views/batch/core.py b/tailbone/views/batch/core.py index de95c068..0f493bc9 100644 --- a/tailbone/views/batch/core.py +++ b/tailbone/views/batch/core.py @@ -634,13 +634,19 @@ class BatchMasterView(MasterView): g.status_code.set(label="Status", renderer=StatusRenderer(self.model_row_class.STATUS)) + + hide_row_status_codes = [] + def get_row_data(self, batch): """ Generate the base data set for a rows grid. """ - return self.Session.query(self.model_row_class)\ - .filter(self.model_row_class.batch == batch)\ - .filter(self.model_row_class.removed == False) + query = self.Session.query(self.model_row_class)\ + .filter(self.model_row_class.batch == batch)\ + .filter(self.model_row_class.removed == False) + if self.hide_row_status_codes: + query = query.filter(~self.model_row_class.status_code.in_(self.hide_row_status_codes)) + return query def row_editable(self, row): """