Signals Reference

Module Summary

next.signals is an aggregator that re-exports every signal emitted by the framework. Importing a signal from next.signals is equivalent to importing it from its subpackage.

Signal Catalog

Every signal below is a Django Signal. The sender column lists the value passed to Signal.send. Receivers connected with a matching sender only fire for that sender.

Signal

Sender

Keyword arguments

When it fires

action_dispatched

FormActionDispatch

action_name, form, url_kwargs, duration_ms, response_status, dep_cache

After an action handler runs and the response is coerced. form is the bound form, or None for handler-only actions. duration_ms times the handler call. dep_cache is a copy of the dispatch dependency-injection cache.

action_registered

Form action backend class

action_name, uid, form_class, namespace, handler

After the backend stores a handler for an action name.

asset_registered

The StaticAsset instance

collector, backend

After a file is registered with a backend and added to the collector.

backend_loaded

The static backend class

config, instance

After the static factory instantiates a backend.

collector_finalized

The static collector

page_path, request

When the static manager begins injection, after template rendering completes. page_path may be None for partial renders. request may be None outside a request.

component_backend_loaded

ComponentsManager

backend, config

After a component backend is created from its configuration entry.

component_registered

ComponentRegistry

info

After a single component is registered. Not fired from the bulk path.

component_rendered

ComponentsManager

info, template_path

After a component is rendered to HTML. template_path may be None for components without a template file.

components_registered

ComponentRegistry

infos

After a batch of components is registered. infos is the tuple of added components.

context_registered

PageContextRegistry

file_path, key

After a context callable is attached to a page module.

form_validation_failed

FormActionDispatch

action_name, error_count, field_names

When the bound form fails validation during dispatch.

html_injected

A StaticManager instance

html_before, html_after, collector, placeholders_replaced, injected_bytes, request

After placeholder replacement completes. placeholders_replaced is the tuple of replaced slot names. injected_bytes is the length delta.

page_rendered

Page

file_path, duration_ms, styles_count, scripts_count, context_keys

After Page.render produces HTML and injects static assets. duration_ms times the render. context_keys is the tuple of context keys.

provider_registered

The RegisteredParameterProvider subclass

none

When a RegisteredParameterProvider subclass is added to the auto-registry.

route_registered

FileRouterBackend

url_path, file_path

After a URL pattern is created for a discovered page.

router_reloaded

The router manager class

none

After the router manager rebuilds its pattern set.

settings_reloaded

NextFrameworkSettings

none

After NextFrameworkSettings.reload drops its caches.

template_loaded

Page

file_path

After a template source is registered on a page.

watch_specs_ready

iter_all_autoreload_watch_specs

specs

After the reloader resolves the full list of watch specs.

Subpackage Signals

The aggregator next.signals forwards from the modules below.

Pages

Signals emitted during template loading, context collection, and rendering.

These signals let external subscribers observe the page rendering pipeline without subclassing internal collaborators.

The template_loaded signal fires after a template source is registered on a page. The sender is Page. The keyword argument is file_path.

The context_registered signal fires after a context callable is attached to a page module. The sender is PageContextRegistry. The keyword arguments are file_path and key.

The page_rendered signal fires after Page.render finishes producing HTML and injecting static assets. The sender is Page. The keyword arguments are file_path, duration_ms, styles_count, scripts_count, and context_keys.

Components

Django signals emitted by the components subsystem.

URLs

Django signals emitted by the URL routing subsystem.

Forms

Django signals emitted by the forms subsystem.

The action_registered signal fires after the backend stores a handler for a name. The sender is the backend class. The keyword arguments are action_name, uid, form_class, namespace, and handler.

The action_dispatched signal fires after a handler runs and the response has been coerced. The sender is FormActionDispatch. The keyword arguments are action_name, form, url_kwargs, duration_ms, response_status, and dep_cache. form is the bound form instance after successful validation, or None for handler-only actions registered without a form_class. url_kwargs is a copy of the URL kwargs the dispatcher resolved before invoking the handler. dep_cache is a snapshot of the dispatch DI cache so receivers can read named dependencies (Depends(“name”) values) resolved during this dispatch without re-running their providers.

The form_validation_failed signal fires when the bound form fails validation during dispatch. The sender is FormActionDispatch. The keyword arguments are action_name, error_count, and field_names.

Static

Django signals emitted across the static pipeline.

Signals are the primary extension mechanism for hooking into asset lifecycle events without subclassing the collector, the backend, or the manager. Subscribe from AppConfig.ready and keep handlers synchronous. All four signals are dispatched in hot rendering paths.

The asset_registered signal fires after a file is registered with a backend and added to the collector. The sender is the asset instance and the keyword arguments are collector and backend.

The collector_finalized signal fires when the static manager begins injection, after template rendering has completed and the collector is sealed. The sender is the collector. The keyword arguments are page_path, which may be None for partial renders, and request, which is the active HttpRequest or None for renders outside a request lifecycle.

The html_injected signal fires after placeholder replacement completes. The sender is the static manager. The keyword arguments are html_before, html_after, collector, placeholders_replaced, injected_bytes, and request. The request argument carries the active HttpRequest or None.

The backend_loaded signal fires after the static factory instantiates a backend. The sender is the backend class. The keyword arguments are config and instance.

Dependencies

Django signals emitted by the dependency-injection layer.

provider_registered fires whenever a RegisteredParameterProvider subclass is added to the auto-registry. External code may listen to the signal to observe provider wiring, typically in tests or diagnostics.

next.deps.signals.provider_registered: Signal = <django.dispatch.dispatcher.Signal object>

Emitted when a RegisteredParameterProvider subclass registers itself.

Server

Signals emitted by the development server watch layer.

watch_specs_ready fires after the reloader resolves the full list of watch specs. Subscribers can inspect or augment the effective spec set without subclassing the reloader.

Configuration

Django signals emitted by the configuration layer.

settings_reloaded fires after NextFrameworkSettings.reload drops its caches. Package-level managers subscribe to this signal and reset their own state when the merged settings change. The module also wires the Django setting_changed signal so that tests using override_settings trigger the reload path automatically.

next.conf.signals.settings_reloaded: Signal = <django.dispatch.dispatcher.Signal object>

Emitted when NextFrameworkSettings caches have been dropped.

See Also

See also

Signals for receiver patterns and testing helpers.