Route types and registration options
Route types
Use searchable and translatable on a registration to override its route type's defaults.
| Type | Transport | Example path | URL name prefix | Model required | Module required | Searchable by default | Translated by default | Description |
|---|---|---|---|---|---|---|---|---|
app | http | /settings/ | — | No | No | Yes | Yes | A global application page. |
model | http | /sales/customers/import/ | — | Yes | Yes | Yes | Yes | A page for a model's collection. The router resolves the model's module. |
detail | http | /sales/customers/<int_or_uuid:pk>/details/ | — | Yes | Yes | Yes | Yes | A page for one model record. The router adds the record's primary-key parameter. |
module | http | /sales/dashboard/ | — | No | Yes | Yes | Yes | A page mounted under a module supplied via modules. |
component | http | /components/widgets/preview/ | components_ | No | No | No | No | A global component endpoint, typically used by HTMX. The router prefixes path with /components/ and preserves complete re_path patterns. |
api | http | /api/status/ | — | No | No | No | No | A global HTTP API endpoint mounted under /api/. |
api_model | http | /api/customers/ | — | Yes | No | No | No | An HTTP API endpoint mounted under a model's collection path. |
api_detail | http | /api/customers/<int_or_uuid:pk>/ | — | Yes | No | No | No | An HTTP API endpoint for one model record. |
websocket | websocket | /ws/notifications/ | — | No | No | Yes | Yes | A Channels consumer registered in the WebSocket URL patterns. |
mcp | mcp | — | — | No | No | No | No | A pathless MCP tool registered with a tool contract. |
mcp_resource | mcp | — | — | No | No | No | No | A pathless MCP resource registered under a URI or URI template. |
Route type details
app
Use app for a page shared across the application, such as settings or the inbox. Declare path relative to the application root. For example, path="settings/" mounts the page at /settings/. Give the route a stable url_name so templates and views can reverse it.
model
Use model for a page that works with a model's collection, such as a list, creation form, or import wizard. Select the models through models. The router uses each model's registered module and plural name to build the collection URL, then appends your path. For example, path="import/" can resolve to /sales/customers/import/.
detail
Use detail for a page tied to one record, such as a details tab or a confirmation form. Select the models through models and declare a path relative to the record. The router inserts <int_or_uuid:pk> before that path. Reverse the route with the record's primary key as pk.
module
Use module for a page that belongs to a module, such as its dashboard. Pass a module ID, a module definition, or a list through modules. The router mounts the view under each selected module's resolved path. For a module mounted at /sales/, path="dashboard/" resolves to /sales/dashboard/.
component
Use component for a separately requested part of a page, such as an HTML fragment loaded through HTMX. Declare path="widgets/preview/" and a reverse name such as widget_preview to get /components/widgets/preview/ and components_widget_preview. If you use re_path, supply the complete URL pattern.
api
Use api for an HTTP endpoint with application-wide scope, such as a status endpoint. The router mounts path="status/" at /api/status/. Supply an sdk contract when the endpoint should appear in the generated SDK.
api_model
Use api_model for collection operations such as listing or creating records. Select the models through models. Each route starts at the model's API collection path, such as /api/customers/. Use path="/" for the collection itself or supply a suffix for a separate collection operation.
api_detail
Use api_detail for an operation on one record, such as retrieving or updating it. Select the models through models. The router inserts <int_or_uuid:pk> after the model's API collection path and before any suffix you supply. The view can use the captured pk to resolve the record.
websocket
Use websocket for a Django Channels consumer that handles live messages or notifications. Register the consumer class so the router can call as_asgi(). Declare the full path, such as path="ws/notifications/", for the WebSocket URL configuration.
mcp
Use mcp for an operation that an MCP client can invoke as a tool. Supply a McpTool contract through mcp to declare the tool's inputs and behavior. The registered url_name identifies the tool. Leave path and re_path unset for an MCP-only route.
mcp_resource
Use mcp_resource for content an MCP client can read by URI, such as a guide or an application reference. Supply a McpResource for a fixed URI or a McpResourceTemplate for parameterized content. The contract supplies the resource address, so leave path and re_path unset.
Registration options
| Option | Type | Default |
|---|---|---|
path | str | None |
re_path | Optional[str] | None |
route_type | RouteType | str | None | None |
models | ModelSelector | None |
modules | ModuleConfig | type[BloomerpModule] | BloomerpModule | str | list[ModuleConfig | type[BloomerpModule] | BloomerpModule | str] | None | None |
exclude_models | ModelSelector | None |
name | Optional[str] | None |
description | Optional[str] | None |
url_name | Optional[str] | None |
override | bool | False |
translatable | Optional[bool] | None |
searchable | Optional[bool] | None |
message_format_values | Optional[dict[str, object]] | None |
mcp | Union[McpTool, McpResource, McpResourceTemplate, NoneType] | None |
sdk | SdkEndpoint | list[SdkEndpoint] | tuple[SdkEndpoint, ...] | None | None |
