Skip to content

Extending and integrating

Display formats

Display formats turn a raw value into a formatted string at export time. They're managed through Django admin at /admin/report_builder/format/.

The format is a Python str.format template applied as format_string.format(value) — e.g. {:.2f} for two decimals, {:%Y-%m-%d} for a date, or ${:,.2f} for currency-style. See Python's format spec mini-language for the full grammar.

Once a format is saved, it appears in the Format dropdown next to each display field in the editor.

Embedding inside another Django site

The bundled SPA renders inside report_builder/spa.html, which extends report_builder/base.html. To slot the report builder into a larger site (headers, navigation, etc.), override report_builder/base.html in your project's templates. The minimal contract is:

  • Define the report_header block (goes inside <head>)
  • Define the content block (where <app-root> and the SPA's script / style tags go)

Example, extending your site's chrome:

{% extends "my_site_base.html" %}
{% load static %}

{% block extra_head %}
    {% block report_header %}{% endblock %}
{% endblock %}

{% block main %}
    {% block content %}{% endblock %}
{% endblock %}

The Angular app needs the full viewport height (or close to it) — give the container height: 100vh or flex: 1 inside a flex parent. If the SPA ends up rendering inside a 0-height container, you'll see a blank screen.

Building your own frontend

If the bundled SPA doesn't fit your use case, the Django backend exposes a fully-documented REST API — see REST endpoints. Set REPORT_BUILDER_FRONTEND = False to disable the SPA and serve only the API.