Built-ins
TileTypeDefinition
Connect a workspace tile’s picker entry to its configuration and renderer.
The module or model supplies an instance of the registered configuration. Workspace layouts reference that instance by its tile ID. The registry key identifies the tile type itself.
| Setting | Type | Default | Description |
|---|---|---|---|
id | str | Required | Stable identifier used by this definition.Minimum length: 1 |
documentation | str | '' | Markdown and tagged examples included in the generated developer reference. |
name | str | Required | Name shown in the tile picker. |
description | str | Required | Summary of what the tile displays or does. |
icon | str | '' | Icon shown in the tile picker. |
form_cls | Optional[Type[Form]] | None | Django form class used to edit this tile. |
model | Optional[Type[BaseTileConfig]] | None | Pydantic configuration class used to validate saved tile settings. |
render_cls | Optional[Type[BaseTileRenderer]] | None | Renderer class used to render a configured tile. |
filter_fields_factory | Callable[[BaseTileConfig], list[FilterField]] | TileTypeDefinition.<lambda> | Callback that exposes a configured tile's workspace filter fields. |
Register a tile with typed settings and a renderer
Define a small configuration model and render the message using Django’s HTML escaping.
from typing import Self
from django.http import HttpRequest
from django.utils.html import format_html
from pydantic import Field
from bloomerp.workspaces.base import BaseTileConfig, BaseTileRenderer, TileOperationDefinition, TileTypeDefinition
from bloomerp.workspaces.registry import TILE_TYPE_REGISTRY
class NoticeTileConfig(BaseTileConfig):
'''Store the text displayed in a notice tile.'''
message: str = Field(default="Dispatch is open.", description="Text shown to users.")
@classmethod
def get_default(cls) -> Self:
'''Build a notice with the default message.'''
return cls()
@classmethod
def get_operation(cls, operation: str) -> TileOperationDefinition:
'''Reject operations because the notice has no interactive controls.'''
raise KeyError(operation)
class NoticeTileRenderer(BaseTileRenderer):
'''Render the notice as an escaped paragraph.'''
@classmethod
def render(cls, config: NoticeTileConfig, request: HttpRequest) -> str:
'''Return the configured message inside a paragraph.'''
return format_html("<p>{}</p>", config.message)
TILE_TYPE_REGISTRY.register(
TileTypeDefinition(
id="EXAMPLE_NOTICE_TILE",
name="Notice",
description="Show a short notice on a workspace.",
model=NoticeTileConfig,
render_cls=NoticeTileRenderer,
),
)Place the new tile on a module workspace
Use the notice configuration from the previous example. Match the layout item ID to the configured tile ID.
from bloomerp.models.definition import LayoutItem, LayoutRow, WorkspaceLayout
from bloomerp.modules.definition import BloomerpModule
class DispatchWorkspaceModule(BloomerpModule):
'''Publish a dispatch workspace with a notice tile.'''
id = "dispatch_board"
name = "Dispatch board"
tiles = [
NoticeTileConfig(id="dispatch-notice", message="Review today's deliveries."),
]
workspaces = [
WorkspaceLayout(
rows=[LayoutRow(columns=1, items=[LayoutItem(id="dispatch-notice")])],
),
]Analytics Tile
ID ANALYTICS_TILE
Visualizes data from a custom query and presents it in a structured format such as a chart, KPI, table, or pie chart.
| Field | Value |
|---|---|
icon | fa-chart-line |
AnalyticsTileConfig
Session-backed configuration for an analytics tile being built.
| Setting | Type | Default | Description |
|---|---|---|---|
id | str | None | None | — |
name | str | None | None | — |
description | str | None | None | — |
icon | str | None | None | — |
filter_shared_keys | dict[str, str | None] | {} | Workspace filter aliases by field name. Omitted fields share by name; null keeps a field tile-specific. |
query | str | Required | Read-only SQL query supplying the tile's data. Selected field names must match columns or aliases returned by this query. |
type | str | Required | Analytics subtype key. Select the matching oneOf branch for its field slots and options. |
fields | dict[str, list[FieldConfig]] | {} | Selected query columns grouped by the chosen subtype's field slots. |
opts | dict | {} | Tile-level display options for the chosen analytics subtype. |
filters | list[AnalyticsTileFilter] | [] | Columns available to interactive tile/workspace filters, as a list of {field, type, shared_key?} registrations. These are not active conditions: do not put lookup/operator/value here or use fields.filter. Conditions are supplied by the filter UI at request time and applied to the SQL result via SELECT * FROM (query) ... WHERE ..., after SQL aggregation. For a permanent restriction or filtering rows before COUNT/GROUP BY, put the predicate in query's WHERE clause. An empty list exposes no interactive filter columns. |
Canvas
ID CANVAS_TILE
A free-form workspace where users can add and arrange different types of content such as text, media, and embedded components.
| Field | Value |
|---|---|
icon | fa-palette |
CanvasTileConfig
| Setting | Type | Default | Description |
|---|---|---|---|
id | str | None | None | — |
name | str | None | None | — |
description | str | None | None | — |
icon | str | None | None | — |
filter_shared_keys | dict[str, str | None] | {} | Workspace filter aliases by field name. Omitted fields share by name; null keeps a field tile-specific. |
content | dict[str, Any] | {} | — |
height | int | 384 | At least: 256At most: 1600 |
Links
ID LINKS_TILE
Provides quick access to a collection of internal or external links, allowing users to navigate efficiently to frequently used resources.
| Field | Value |
|---|---|
icon | fa-link |
LinkTileConfig
Configuration for a tile displaying navigation links and nested folders.
| Setting | Type | Default | Description |
|---|---|---|---|
id | str | None | None | — |
name | str | None | None | — |
description | str | None | None | — |
icon | str | None | None | — |
filter_shared_keys | dict[str, str | None] | {} | Workspace filter aliases by field name. Omitted fields share by name; null keeps a field tile-specific. |
links | list[Link] | Required | Ordered top-level links and folders displayed on the tile. Nest items in a folder's children. This list is required; an empty list creates an empty tile. |
Text
ID TEXT_TILE
Displays simple markdown content such as notes, instructions, or reference text.
| Field | Value |
|---|---|
icon | fa-align-left |
TextTileConfig
| Setting | Type | Default | Description |
|---|---|---|---|
id | str | None | None | — |
name | str | None | None | — |
description | str | None | None | — |
icon | str | None | None | — |
filter_shared_keys | dict[str, str | None] | {} | Workspace filter aliases by field name. Omitted fields share by name; null keeps a field tile-specific. |
markdown | str | '' | — |
Data View
ID DATAVIEW_TILE
Displays and manages records from a selected model in a structured view with filtering, sorting, and interaction capabilities.
| Field | Value |
|---|---|
icon | fa-table |
DataViewTileConfig
| Setting | Type | Default | Description |
|---|---|---|---|
id | str | None | None | — |
name | str | None | None | — |
description | str | None | None | — |
icon | str | None | None | — |
filter_shared_keys | dict[str, str | None] | {} | Workspace filter aliases by field name. Omitted fields share by name; null keeps a field tile-specific. |
content_type_id | int | None | None | — |
list_view_preference_id | int | None | None | — |
actions | list[str] | None | None | — |
initial_query_params | dict[str, object] | {} | Query parameters applied when the data view tile is rendered. |
Form
ID FORM_TILE
Displays a form, containing inputs, etc.
| Field | Value |
|---|---|
icon | fa-rectangle-list |
FormTileConfig
| Setting | Type | Default | Description |
|---|---|---|---|
id | str | None | None | — |
name | str | None | None | — |
description | str | None | None | — |
icon | str | None | None | — |
filter_shared_keys | dict[str, str | None] | {} | Workspace filter aliases by field name. Omitted fields share by name; null keeps a field tile-specific. |
form_id | str | Required | — |
