Reporting Settings
Developer guide for the Enezaframework reporting engine. Part of the Add Report series.
Table of Contents
Overview
Configure the reporting engine with an ENEZA_REPORTING_SETTINGS dict in your Django
settings. Your values are merged over the engine defaults, so you only specify what you
want to change.
Module: enezareporting/eneza_reporting_settings.py.
How Settings Are Merged
flowchart TD
DEF["ENEZA_REPORTING_SETTINGS_DEFAULT"] --> MERGE["get_eneza_reporting_settings()"]
USER["settings.ENEZA_REPORTING_SETTINGS"] --> MERGE
MERGE --> CHARTS["CHARTS: per-engine merge"]
MERGE --> MEDIA["MEDIA: append, or replace when override=True"]
MERGE --> EFFECTIVE["ENEZA_REPORTING_SETTINGS (lazy)"]The merge is computed lazily and cached via lazy(get_eneza_reporting_settings, dict)
(eneza_reporting_settings.py:111-144). Two keys get special treatment:
CHARTS— user engine configs are merged per engine over the defaults.MEDIA— withoverride: False(default), userjs/cssare appended to the defaults; withoverride: True, user media fully replaces the defaults.
Two legacy settings, ENEZA_REPORTING_DEFAULT_START_DATE and
ENEZA_REPORTING_DEFAULT_END_DATE, override the computed date defaults for backward
compatibility.
Default Settings
The complete default set (eneza_reporting_settings.py:41-108):
ENEZA_REPORTING_SETTINGS = {
"JQUERY_URL": "https://code.jquery.com/jquery-3.7.0.min.js",
"DEFAULT_START_DATE_TIME": <first day of this year>,
"DEFAULT_END_DATE_TIME": <today>,
"DEFAULT_CHARTS_ENGINE": "highcharts",
"MEDIA": {
"override": False,
"js": (
"https://cdn.jsdelivr.net/momentjs/latest/moment.min.js",
"https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js",
"https://cdn.datatables.net/1.13.4/js/dataTables.bootstrap5.min.js",
"eneza_reporting/eneza_reporting.js",
"eneza_reporting/eneza_reporting.report_loader.js",
"eneza_reporting/eneza_reporting.datatable.js",
),
"css": {
"all": (
"https://cdn.datatables.net/1.13.4/css/dataTables.bootstrap5.min.css",
)
},
},
"FONT_AWESOME": {
"CSS_URL": "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css",
"ICONS": {
"pie": "fas fa-chart-pie",
"bar": "fas fa-chart-bar",
"line": "fas fa-chart-line",
"area": "fas fa-chart-area",
"column": "fas fa-chart-bar",
},
},
"CHARTS": {
"highcharts": {
"entryPoint": "$.eneza_reporting.highcharts.displayChart",
"js": (
"https://cdn.jsdelivr.net/npm/highcharts@11/highcharts.js",
"eneza_reporting/eneza_reporting.highchart.js",
),
},
"chartsjs": {
"entryPoint": "$.eneza_reporting.chartsjs.displayChart",
"js": (
"https://cdn.jsdelivr.net/npm/chart.js",
"eneza_reporting/eneza_reporting.chartsjs.js",
),
},
},
"MESSAGES": {
"total": "Total",
"export_to_csv": "Export to CSV",
"print_report": "Print",
},
"REPORT_VIEW_ACCESS_FUNCTION": "enezareporting.helpers.user_test_function",
"QUERY_INTEGRATION_ENABLED": True,
"DRILLDOWN_MAX_DEPTH": 5,
"DRILLDOWN_TEMPLATE": "",
"DOCUMENT_TEMPLATE": "",
"DOCUMENT_DEFAULTS": {
"company_name": "Enezatech Digital Solutions",
"currency": "KES",
"footer_text": "Confidential",
},
"REPORT_PAGE_SIZE": 20,
"PAGE_SETTINGS": {
"page_width_mm": 210,
"page_height_mm": 297,
"page_margin_mm": 10,
"page_size_name": "A4",
},
}
Common Overrides
# settings.py
from datetime import datetime
ENEZA_REPORTING_SETTINGS = {
"QUERY_INTEGRATION_ENABLED": True, # workflow-engine SavedQuery integration
"DRILLDOWN_MAX_DEPTH": 5, # max drill-down levels
"DRILLDOWN_TEMPLATE": "", # custom drill-down template override
"DOCUMENT_TEMPLATE": "", # custom document template override
"DOCUMENT_DEFAULTS": {
"company_name": "My Company Ltd.",
"currency": "USD",
"footer_text": "Confidential",
},
"DEFAULT_START_DATE_TIME": datetime(2024, 1, 1),
"DEFAULT_END_DATE_TIME": datetime(2024, 12, 31),
"CHARTS": {
"highcharts": {
"entryPoint": "$.eneza_reporting.highcharts.displayChart",
"js": ("https://cdn.jsdelivr.net/npm/highcharts@11/highcharts.js",),
},
},
"MESSAGES": {
"total": "Total",
"export_to_csv": "Export to CSV",
"print_report": "Print",
},
"REPORT_VIEW_ACCESS_FUNCTION": "enezareporting.helpers.user_test_function",
"REPORT_PAGE_SIZE": 20,
}
This is a partial override, not the full schema — unspecified keys keep their defaults.
Access Control
REPORT_VIEW_ACCESS_FUNCTION is a dotted path resolved with get_callable()
(eneza_reporting_settings.py:151-153). The callable receives the view instance and
returns whether access is allowed; see
access control in Report Views.