Show link back to Poser Report when viewing Generated Report
i.e. where applicable / possible. also allow bulk-delete of generated reports, and show name filter by default for that grid
This commit is contained in:
parent
691a5e84f9
commit
3fae9e6270
|
@ -214,6 +214,7 @@ class ReportOutputView(ExportMasterView):
|
|||
url_prefix = '/reports/generated'
|
||||
creatable = True
|
||||
downloadable = True
|
||||
bulk_deletable = True
|
||||
configurable = True
|
||||
config_title = "Reporting"
|
||||
config_url = '/reports/configure'
|
||||
|
@ -246,14 +247,38 @@ class ReportOutputView(ExportMasterView):
|
|||
|
||||
def configure_grid(self, g):
|
||||
super(ReportOutputView, self).configure_grid(g)
|
||||
|
||||
g.filters['report_name'].default_active = True
|
||||
g.filters['report_name'].default_verb = 'contains'
|
||||
|
||||
g.set_link('filename')
|
||||
|
||||
def configure_form(self, f):
|
||||
super(ReportOutputView, self).configure_form(f)
|
||||
|
||||
# report_type
|
||||
f.set_renderer('report_type', self.render_report_type)
|
||||
|
||||
# params
|
||||
f.set_renderer('params', self.render_params)
|
||||
|
||||
def render_report_type(self, output, field):
|
||||
type_key = getattr(output, field)
|
||||
|
||||
# (try to) show link to poser report if applicable
|
||||
if type_key and type_key.startswith('poser_'):
|
||||
app = self.get_rattail_app()
|
||||
poser_handler = app.get_poser_handler()
|
||||
poser_key = type_key[6:]
|
||||
report = poser_handler.normalize_report(poser_key)
|
||||
if not report.get('error'):
|
||||
url = self.request.route_url('poser.reports.view',
|
||||
report_key=poser_key)
|
||||
return tags.link_to(type_key, url)
|
||||
|
||||
# fallback to showing value as-is
|
||||
return type_key
|
||||
|
||||
def render_params(self, report, field):
|
||||
params = report.params
|
||||
if not params:
|
||||
|
|
Loading…
Reference in a new issue