diff --git a/tailbone/templates/poser/reports/view.mako b/tailbone/templates/poser/reports/view.mako index cb6490cd..aac0c7ae 100644 --- a/tailbone/templates/poser/reports/view.mako +++ b/tailbone/templates/poser/reports/view.mako @@ -59,6 +59,7 @@ ${h.end_form()} % endif +
<%def name="modify_this_page_vars()"> diff --git a/tailbone/views/poser/reports.py b/tailbone/views/poser/reports.py index 8098e1f9..972ee66f 100644 --- a/tailbone/views/poser/reports.py +++ b/tailbone/views/poser/reports.py @@ -75,6 +75,24 @@ class PoserReportView(MasterView): 'error', ] + has_rows = True + + @property + def model_row_class(self): + return self.model.ReportOutput + + row_labels = { + 'id': "ID", + } + + row_grid_columns = [ + 'id', + 'report_name', + 'filename', + 'created', + 'created_by', + ] + def __init__(self, request): super(PoserReportView, self).__init__(request) app = self.get_rattail_app() @@ -224,6 +242,36 @@ class PoserReportView(MasterView): def download_path(self, report, filename): return report['module_file_path'] + def get_row_data(self, report): + model = self.model + + if report.get('error'): + return [] + + return self.Session.query(model.ReportOutput)\ + .filter(model.ReportOutput.report_type == report['report'].type_key) + + def get_parent(self, output): + key = output.report_type + for report in self.get_data(): + if not report.get('error'): + if report['report'].type_key == key: + return report + + def configure_row_grid(self, g): + super(PoserReportView, self).configure_row_grid(g) + + g.set_renderer('id', self.render_id_str) + + g.set_sort_defaults('created', 'desc') + + g.set_link('id') + g.set_link('filename') + g.set_link('created') + + def row_view_action_url(self, output, i): + return self.request.route_url('report_output.view', uuid=output.uuid) + def delete_instance(self, report): self.poser_handler.delete_report(report['report_key'])