Settings
Note
Settings are changed in version 1.1.1 to being a dictionary instead of individual variables. Variables will continue to work till next major release.
Below are the default settings for django-slick-reporting. You can override them in your settings file.
SLICK_REPORTING_SETTINGS = {
"JQUERY_URL": "https://code.jquery.com/jquery-3.7.0.min.js",
"DEFAULT_START_DATE_TIME": datetime(
datetime.now().year, 1, 1, 0, 0, 0, tzinfo=timezone.utc
), # Default: 1st Jan of current year
"DEFAULT_END_DATE_TIME": datetime.datetime.today(), # Default to today
"DEFAULT_CHARTS_ENGINE": SLICK_REPORTING_DEFAULT_CHARTS_ENGINE,
"MEDIA": {
"override": False, # set it to True to override the media files,
# False will append the media files to the existing ones.
"js": (
"https://cdn.jsdelivr.net/momentjs/latest/moment.min.js",
"https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.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",
"slick_reporting/slick_reporting.js",
"slick_reporting/slick_reporting.report_loader.js",
"slick_reporting/slick_reporting.datatable.js",
),
"css": {
"all": (
"https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css",
"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-column",
},
},
"CHARTS": {
"highcharts": "$.slick_reporting.highcharts.displayChart",
"chartjs": "$.slick_reporting.chartjs.displayChart",
},
"MESSAGES": {
"total": _("Total"),
},
}
JQUERY_URL:
Link to the jquery file, You can use set it to False and manage the jQuery addition to your liking
DEFAULT_START_DATE_TIME
Default date time that would appear on the filter form in the start date
DEFAULT_END_DATE_TIME
Default date time that would appear on the filter form in the end date
FONT_AWESOME:
Font awesome is used to display the icon next to the chart title. You can override the following settings:
CSS_URL
: URL to the font-awesome css fileICONS
: Icons used for different chart types.
CHARTS:
The entry points for displaying charts on the front end. You can add your own chart engine by adding an entry to this dictionary.
MESSAGES:
The strings used in the front end. You can override them here, it also gives a chance to set and translate them per your requirements.
Old versions settings:
SLICK_REPORTING_DEFAULT_START_DATE
: Default: the beginning of the current yearSLICK_REPORTING_DEFAULT_END_DATE
: Default: the end of the current year.SLICK_REPORTING_FORM_MEDIA
: Controls the media files required by the search form. Defaults is:
SLICK_REPORTING_FORM_MEDIA = {
"css": {
"all": (
"https://cdn.datatables.net/v/bs4/dt-1.10.20/datatables.min.css",
"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.css",
)
},
"js": (
"https://code.jquery.com/jquery-3.3.1.slim.min.js",
"https://cdn.datatables.net/v/bs4/dt-1.10.20/datatables.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.bundle.min.js",
"https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.3/Chart.min.js",
"https://code.highcharts.com/highcharts.js",
),
}
SLICK_REPORTING_DEFAULT_CHARTS_ENGINE
: Controls the default chart engine used.