model_report.export_pdf.render_to_pdf(report, template_src, context_dict, pdf_encoding='UTF-8')

Render the report results to pdf format.

Keyword arguments: report – a report instance template_src – template file path context_dict – context dictionary pdf_encoding – encoding to render string



Try to fit columns to max size of any entry. To use, wrap this around a worksheet returned from the workbook’s add_sheet method, like follows:

sheet = FitSheetWrapper(book.add_sheet(sheet_name))

The worksheet interface remains the same: this is a drop-in wrapper for auto-sizing columns.

class, request=None)

Class to represent a Report.

chart_types = ()

List of highchart types.

exports = ('excel', 'pdf')

Alternative render report as “pdf” or “csv”.

fields = []

List of fields or lookup fields for query results to be listed.


Return the list of columns


Return the the queryset


Return the report title

group_totals = {}

Dictionary with field name as key and function to calculate their values.

inlines = []

List of other’s Report related to the main report.

list_filter = ()

List of fields or lookup fields to filter data.

list_filter_queryset = {}

ForeignKey custom queryset

list_filter_widget = {}

Widget for list filter field

list_group_by = ()

List of fields or lookup fields to group data.

list_order_by = ()

List of fields or lookup fields to order data.

list_serie_fields = ()

List of fields to group by results in chart.

model = None

Primary django model to query.

override_field_choices = {}


override_field_filter_values = {}


override_field_formats = {}

Dictionary with field name as key and function to parse their value after override_field_values().

override_field_labels = {}

Dictionary with field name as key and function to parse the column label.

override_field_values = {}

Dictionary with field name as key and function to parse their original values.

override_field_values = {
    'men': men_format,
    'women': women_format
override_group_value = {}


query_set = None


report_totals = {}

Dictionary with field name as key and function to calculate their values.

template_name = None

Template file name to render the report.

title = None

Title of the report.

type = 'report'

“report” for only report and “chart” for report and chart graphic results.


Class to handle registered reports class.

Auto-discover INSTALLED_APPS modules and fail silently when not present. Borrowed form django.contrib.admin

Usages of this decorator have been removed from the ReportAdmin base class.

Caching method returns gets in the way of customization at the implementation level now that report instances can be modified based on request data.


class model_report.utils.ReportRow

Class to represent report rows


  • is_total - defined as True if row is a group total row or report total row
  • is_caption - TODO

Render css classes to this row into html representation


Evaluate True if the row is a normal row or not

class model_report.utils.ReportValue(value)

Class to represent cells values for report rows


  • value - real value from database
  • is_report_total - defined as True if value is for showing in report total row
  • is_group_total - defined as True if value is for showing in group total row
  • is_value - defined as True if value is for showing in normal row
format(value, instance)

Format the value instance.


Render as text the value. This function also format the value.


Average values for any column

model_report.utils.base_label(report, field)

Basic label


Count values for any column

model_report.utils.date_format(value, instance)

Format cell value to friendly date string

model_report.utils.round_format(value, instance)

Format value to render with 2 decimal places


Sum values for any column

model_report.utils.usd_format(value, instance)

Format cell value to money

model_report.utils.yesno_format(value, instance)

Format boolean value to render Yes or No if True or False


class model_report.widgets.RangeField(field_class, widget=<class 'django.forms.widgets.TextInput'>, *args, **kwargs)

Field to filter date values by range.

class model_report.widgets.RangeWidget(widget, *args, **kwargs)

Render 2 inputs with vDatepicker class in order to select a date range.