Signals reference#

Module summary#

next.signals is an aggregator that re-exports every framework signal. 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.

The dispatch-time form signals (action_dispatched, form_validation_failed, wizard_step_submitted, wizard_completed, form_access_denied) share two keyword arguments. uid is the registry identity of the action, the value the dispatch URL and the data-next-action markup attribute carry, or None when a custom backend stores no uid in its meta. request is the live HttpRequest being dispatched and must not be retained past the receiver call.

Signal

Sender

Keyword arguments

When it fires

action_dispatched

FormActionDispatch

action_name, uid, request, form, url_kwargs, duration_ms, response_status, dep_cache

After an action handler runs and the response is coerced, and once per valid wizard step. form is the bound form, or None for handler-only actions. duration_ms times the handler call and is 0.0 on a wizard step advance, which runs no handler. dep_cache is a copy of the dispatch dependency-injection cache.

action_registered

Form action backend class

action_name, uid, form_class, wizard_class, file_path, scope, handler

After the backend stores an action target for a name. Exactly one of handler, form_class, or wizard_class identifies the target, except the @action(form_class=...) path which supplies a handler and a form factory together.

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 is the file path of the rendered page. A standalone zone render does not fire this signal. request may be None outside a request.

component_backend_loaded

The component backend class

config, instance

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.

field_validated

The active partial protocol backend class

action_name, uid, request, field_names, error_count

After a validate-only blur pass runs, always behind the action guard so unauthenticated validate traffic never reaches telemetry. field_names is the validated subset. error_count is the number of fields that failed.

form_access_denied

FormActionDispatch

action_name, uid, request, layer, reason

When a dynamic permission hook denies a request, never on the static guard path. layer is "view" or "object". reason is "raised", "denied", or "response".

form_validation_failed

FormActionDispatch

action_name, uid, request, 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. Fired only when a receiver is connected, and the duration_ms timer runs under the same gate.

patch_op_registered

PatchOpRegistry

name

After a custom patch verb is registered through register_patch_op.

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.

sse_stream_closed

PatchEventStream

request, duration_ms, envelopes_sent

When a patch event stream ends, its source exhausted or the client gone. envelopes_sent counts the envelopes flushed over the connection.

sse_stream_opened

PatchEventStream

request

When a patch event stream starts.

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.

wizard_completed

The wizard class

cleaned_data, uid, request

After the wizard done method runs for the final step and its response is below HTTP 400. An error response from done skips the signal and keeps the saved drafts. cleaned_data is the merged mapping passed to done.

wizard_step_submitted

The wizard class

step, cleaned_data, uid, request

After a FormWizard step validates during dispatch. cleaned_data is a copy of that step’s validated data.

zone_registered

The compiled page template class

template, zone_name, lazy, poll

Once per compiled composed template, when its named zones are first read. lazy is the trigger string or None, poll the interval in milliseconds or None.

zone_rendered

ZoneRenderResult

zone_name, page_path, request, duration_ms

After a zone body renders for a partial request. duration_ms times the zone render.

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 an action target for a name. The sender is the backend class. The keyword arguments are action_name, uid, form_class, wizard_class, file_path, scope, and handler. Exactly one of handler, form_class, or wizard_class identifies the registered target, except the @action(form_class=…) path which supplies a handler and a form factory together. file_path is the module the form, wizard, or handler was declared in and scope is “page” or “shared”. Together they give receivers a real grouping key under the file-scoped model.

Every dispatch-time signal (action_dispatched, form_validation_failed, wizard_step_submitted, wizard_completed) carries uid and request. uid is the registry identity of the action, the same value the action URL and the data-next-action markup attribute carry, or None when a custom backend stores no uid in its meta. request is the live HttpRequest being dispatched and must not be retained past the receiver call.

The action_dispatched signal fires after a handler runs and the response has been coerced. It also fires once per valid wizard step, where a step advance runs no handler and reports duration_ms as 0.0. The sender is FormActionDispatch. The keyword arguments are action_name, uid, request, 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, uid, request, error_count, and field_names.

The wizard_step_submitted signal fires after a FormWizard step validates during dispatch. The sender is the wizard class, so receivers connected with sender=MyWizard fire for that wizard only. The keyword arguments are step, cleaned_data, uid, and request. cleaned_data is a copy of the validated cleaned data for that step.

The wizard_completed signal fires after the wizard done method runs for the final step and its response is below HTTP 400. An error response from done skips the signal and keeps the saved drafts for retry. The sender is the wizard class. The keyword arguments are cleaned_data, uid, and request. cleaned_data is the merged mapping passed to done.

The form_access_denied signal fires only when a dynamic permission hook denies a request, never on the static ActionGuard fast-path. The sender is FormActionDispatch. The keyword arguments are action_name, uid, request, layer, and reason. layer is “view” for a check_permissions denial or “object” for a has_object_permission denial. reason is “raised” when the hook raised PermissionDenied, “denied” when it returned False, or “response” when it returned an HttpResponse short-circuit.

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, the rendered page’s file path, and request, the active HttpRequest or None for renders outside a request lifecycle. A standalone zone render does not fire this signal, since it ships its assets through the patch envelope rather than through injection.

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 shared backend loader instantiates a static backend. The sender is the backend class. The keyword arguments are config and instance.

Partial rendering#

Django signals emitted by the partial-rendering subsystem.

Every signal name is past tense and the sender is the owning class. The hot-path idiom is to send only when the signal has receivers, so a quiet deployment pays nothing.

The zone_registered signal fires once per compiled composed template when its named zones are first read. The sender is the compiled template class. The keyword arguments are template, zone_name, lazy, and poll.

The zone_rendered signal fires after a zone body renders for a partial request. The sender is the ZoneRenderResult class. The keyword arguments are zone_name, page_path, request, and duration_ms.

The patch_op_registered signal fires after a custom patch verb is registered through register_patch_op. The sender is PatchOpRegistry. The keyword argument is name.

The field_validated signal fires after a validate-only pass runs, always behind the action guard so unauthenticated validate traffic never reaches telemetry. The sender is the backend class. The keyword arguments are action_name, uid, request, field_names, and error_count.

The sse_stream_opened signal fires when a patch event stream starts. The sender is PatchEventStream. The keyword argument is request.

The sse_stream_closed signal fires when a patch event stream ends. The sender is PatchEventStream. The keyword arguments are request, duration_ms, and envelopes_sent.

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.