Installation¶
Requirements¶
| Python | 3.10 -- 3.13 |
| Django | 5.2 LTS or 6.0 (6.0 needs Python 3.12+) |
| Database | anything Django supports |
The following are installed automatically as dependencies: django-dsl, djangoql-iplweb, django-tables2, tablib, lxml, pypandoc and bleach.
Install the package¶
Or, with uv:
Configure the project¶
Add the app -- and django_tables2, which does the actual rendering -- to
INSTALLED_APPS:
INSTALLED_APPS = [
...
"django.contrib.admin", # to edit report definitions
"django.contrib.contenttypes", # required: models point at ContentType
...
"django_tables2",
"flexible_reports",
]
"flexible_reports.apps.FlexibleReportsConfig" also works; it is the same
app config Django picks up by default.
Enable the request context processor. {% flexible %} hands the
surrounding template context to the django-tables2 adapter, which needs
request in it:
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
...
"OPTIONS": {
"context_processors": [
...
"django.template.context_processors.request",
],
},
},
]
Then create the tables:
No URLconf changes¶
Note
There is nothing to add to your URLconf. flexible_reports.urls
exists but its urlpatterns is empty and flexible_reports.views is
empty too -- the app ships no views. You render reports from your own
views (see Quickstart).
Older versions of this documentation told you to write
url(r'^', include(flexible_reports_urls)). That advice was doubly
wrong: it achieved nothing, and django.conf.urls.url was removed in
Django 4.0.
Optional extras¶
- grappelli
- If django-grappelli is installed,
flexible_reports.admin.helpersdetects it at import time and theColumn,ColumnOrderandReportElementinlines become drag-and-drop sortable. Nothing needs to be configured. Without grappelli the inlines simply show a numeric Position field. - pandoc
- Exporting a report to
.docxshells out to pandoc throughpypandoc, so thepandocbinary has to be present on the machine (apt install pandoc,brew install pandoc). HTML and tablib (XLSX/CSV/…) exports need nothing extra.