## -*- mode: python; coding: utf-8; -*-
# -*- coding: utf-8; -*-
"""
Poser Report generated by ${app_title}
"""

from rattail.reporting import ExcelReport


% if include_comments:
# nb. the "docstring" for the class is used as report description.
% endif
class ${cap_name}(ExcelReport):
    """
    ${description}
    """

    name = "${name}"

    % if include_comments:
    # nb. you can change this if needed, but it should remain unique.
    # at the very least never remove the 'poser_' prefix.
    % endif
    type_key = 'poser_${key}'

    % if include_comments:
    # nb. only these columns will be included in excel output, and in
    # this particular order.
    % endif
    output_fields = [
        % for field in output_fields:
        '${field}',
        % endfor
    ]

    % if include_comments:
    # nb. this method must return all primary data for the report.
    # args to this method include a current ${app_title} DB session,
    # and dict of report params.  return value must be a list of
    # dicts, each of which represents a row in the excel output.
    % endif
    def make_data(self, session, params, progress=None, **kwargs):
${self.render_make_data_body()}

<%def name="render_make_data_body()">\

        # TODO: gather some report data...

        return []

    % if include_comments:
    # nb. this determines the output filename; note that you have
    # access to the full report data here in addition to params.
    % endif
    def make_filename(self, session, params, data, **kwargs):
        return "{}.xlsx".format(self.name)
</%def>
