Report Generator API

The main class responsible generating the report and managing the flow


class slick_reporting.generator.ReportGenerator(report_model=None, main_queryset=None, start_date=None, end_date=None, date_field=None, q_filters=None, kwargs_filters=None, group_by=None, group_by_custom_querysets=None, group_by_custom_querysets_column_verbose_name=None, columns=None, time_series_pattern=None, time_series_columns=None, time_series_custom_dates=None, crosstab_field=None, crosstab_columns=None, crosstab_ids=None, crosstab_ids_custom_filters=None, crosstab_compute_remainder=None, swap_sign=False, show_empty_records=None, print_flag=False, doc_type_plus_list=None, doc_type_minus_list=None, limit_records=False, format_row_func=None, container_class=None, start_date_field_name=None, end_date_field_name=None)[source]

The main class responsible generating the report and managing the flow

Below are the basic needed attrs

report_model = None
queryset = None
date_field = ''
columns = None
group_by = None

Below are the needed attrs and methods for time series manipulation

time_series_pattern = ''
time_series_columns = None

Hook to get custom , maybe separated date periods :return: [ (date1,date2) , (date3,date4), …. ]

get_time_series_field_verbose_name(computation_class, date_period, index, series, pattern=None)[source]

Sent the column data to construct a verbose name. Default implementation is delegated to the ReportField.get_time_series_field_verbose_name (which is name + the end date %Y%m%d)

  • computation_class – the computation field_name
  • date_period – a tuple of (start_date, end_date)

a verbose string

Below are the needed attrs and methods for crosstab manipulation

crosstab_field = None
crosstab_columns = None
crosstab_ids = None
crosstab_compute_remainder = True
get_crosstab_field_verbose_name(computation_class, model, id)[source]

Hook to change the crosstab field verbose name, default it delegate this function to the ReportField :param computation_class: ReportField Class :param model: the model name as string :param id: the current crosstab id :return: a verbose string

Below are the magical attrs

limit_records = None
swap_sign = False
field_registry_class = <slick_reporting.registry.ReportFieldRegistry object>

You can have a custom computation field locator! It only needs a get_field_by_name(string) and returns a ReportField`