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?
This commit is contained in:
Lance Edgar 2017-01-30 17:08:05 -06:00
parent e452ea1ae9
commit 12545c6a20

View file

@ -634,13 +634,19 @@ class BatchMasterView(MasterView):
g.status_code.set(label="Status", g.status_code.set(label="Status",
renderer=StatusRenderer(self.model_row_class.STATUS)) renderer=StatusRenderer(self.model_row_class.STATUS))
hide_row_status_codes = []
def get_row_data(self, batch): def get_row_data(self, batch):
""" """
Generate the base data set for a rows grid. Generate the base data set for a rows grid.
""" """
return self.Session.query(self.model_row_class)\ query = self.Session.query(self.model_row_class)\
.filter(self.model_row_class.batch == batch)\ .filter(self.model_row_class.batch == batch)\
.filter(self.model_row_class.removed == False) .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): def row_editable(self, row):
""" """