Show list of generated reports when viewing Poser Report
This commit is contained in:
parent
18625efa87
commit
691a5e84f9
|
@ -59,6 +59,7 @@
|
|||
${h.end_form()}
|
||||
</div>
|
||||
% endif
|
||||
<br />
|
||||
</%def>
|
||||
|
||||
<%def name="modify_this_page_vars()">
|
||||
|
|
|
@ -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'])
|
||||
|
||||
|
|
Loading…
Reference in a new issue