Skip to content

Report Block

A Report Block is one section of a Report Template. Blocks are rendered in order to produce the final report body and can pull dynamic data from Nautobot — saved views, export templates, Jinja templates — or contain static content like rich text, a title page, or a table of contents. Each template is built up from a sequence of blocks; reordering, enabling, or disabling blocks changes the layout and contents of every subsequent Published Report generated from that template.

The ReportBlock model for nautobot_reports provides the following fields:

  • report_template (ReportTemplate reference): The parent template this block belongs to. Deleting the template cascades to its blocks.
  • weight (integer): Sort order within the template; lower values render first. Single-use blocks have locked slots (title_page=0, table_of_contents=10); user-managed blocks must use >=100.
  • block_type (choice): The kind of content this block renders. One of title_page, table_of_contents, rich_text, saved_view, custom_jinja, export_template, or page_break.
  • label (string): Optional label shown next to the block in the report builder UI. Helps identify the block when scanning the block list; not rendered in the exported report.
  • config (JSON object): Block-type-specific configuration payload. The shape depends on block_type (for example, filter parameters for a saved view).
  • content (text): Rich text or Jinja template body for this block. Used by rich_text and custom_jinja block types.
  • heading_text (string): Optional inline heading rendered above the block's content. Leave blank to omit.
  • heading_level (choice): Heading level (h1, h2, or h3) applied to heading_text on all blocks except the title and table of contents. Only used when heading_text is set.
  • subheading_text (string): Optional inline subheading rendered below the heading on the title block. Leave blank to omit.
  • subheading_level (choice): Heading level (h1, h2, or h3) applied to subheading_text. Only used when subheading_text is set.
  • include_in_report (boolean): When enabled, the block is rendered inline in the report body. Defaults to enabled. Disabling it while is_attachment is enabled produces an attachment-only block — its data is emailed as a file but does not appear in the report body.
  • in_report_rows (integer): Maximum number of rows the block renders in the report body (default 10). Only used by saved_view and export_template block types. The emailed file attachment is capped separately by attachment_rows.
  • is_attachment (boolean): When enabled (and the block type supports it), the block's data is also attached to the report email as a file in the format specified by attachment_type. Only Saved View and Export Template blocks support attachments; every other block type ignores this flag. Attachments are produced by the Publish And Email Report job whenever the report is emailed.
  • attachment_type (choice): File format used when the block is attached. One of csv, docx, or pdf. Only consulted when is_attachment is true and the block type supports export. For an Export Template block, csv is honored only when the export template itself produces CSV (its file extension is .csv); otherwise the CSV attachment is skipped and a warning is logged, so non-CSV output is never mislabeled as a spreadsheet.
  • attachment_rows (integer): Maximum number of rows included in the file attachment. Applies to CSV, DOCX, and PDF attachments (the inline report body uses in_report_rows instead). Only used when is_attachment is true and the block type supports export.
  • saved_view (SavedView reference): Optional Nautobot Saved View used by saved_view block types to drive the rendered table.
  • export_template (ExportTemplate reference): Optional Nautobot Export Template used by export_template block types to render data.
  • author (string): Author name shown on the title page. Optional; only used by title_page blocks.
  • prepared_for (string): Name of the person or organization the report is prepared for. Optional; only used by title_page blocks.
  • date (datetime): Date shown on the title page. Optional; only used by title_page blocks.
  • include_headings_up_to (choice): Deepest heading level (h1, h2, or h3) included in the table of contents; block headings deeper than this level are omitted. Defaults to h2. Only used by table_of_contents blocks.
  • render_as_markdown (boolean): When enabled, the block's rendered template output is additionally interpreted as Markdown, so lists, tables, and headings written in the template render as formatted HTML. Disable to treat the output as raw HTML. Defaults to enabled. Only used by custom_jinja blocks.
  • smart_formatting (boolean): Render Markdown, HTML, and CSV export template output natively. Disable to see the raw template output. Defaults to enabled. Only used by export_template blocks.

Wide tables in Saved View, Export Template, and Jinja Template blocks

Blocks that render a table (Saved View, Export Template, and table-producing Jinja Template blocks) are constrained to the width of the report page. The columns share the available width so the whole table stays within the page margins in the preview and in the PDF/DOCX export — the table is never allowed to overflow horizontally or scroll off the side.

A table with many columns is squeezed to fit, which can make the cells cramped and hard to read. If a rendered table is too wide to be legible, reduce the number of columns at the source:

  • Saved View block — edit the Saved View and hide columns you don't need.
  • Export Template block — adjust the export template so it emits fewer columns.
  • Jinja Template block — narrow the query or template output.