
* feat: allow to set defaults * refactor: remove input validation and link to it * feat: component URL * refactor: fix linter errors * refactor: fix linter errors + update examples to use Component.View..get * docs: update comment * refactor: revert change to hash_comp_cls * docs: update comment
7.1 KiB
Extension hooks
Overview of all the extension hooks available in Django Components.
Read more on Extensions.
Hooks
::: django_components.extension.ComponentExtension.on_component_class_created options: heading_level: 3 show_root_heading: true show_signature: true separate_signature: true show_symbol_type_heading: false show_symbol_type_toc: false show_if_no_docstring: true show_labels: false
Available data:
name | type | description |
---|---|---|
component_cls |
Type[Component] |
The created Component class |
::: django_components.extension.ComponentExtension.on_component_class_deleted options: heading_level: 3 show_root_heading: true show_signature: true separate_signature: true show_symbol_type_heading: false show_symbol_type_toc: false show_if_no_docstring: true show_labels: false
Available data:
name | type | description |
---|---|---|
component_cls |
Type[Component] |
The to-be-deleted Component class |
::: django_components.extension.ComponentExtension.on_component_data options: heading_level: 3 show_root_heading: true show_signature: true separate_signature: true show_symbol_type_heading: false show_symbol_type_toc: false show_if_no_docstring: true show_labels: false
Available data:
name | type | description |
---|---|---|
component |
Component |
The Component instance that is being rendered |
component_cls |
Type[Component] |
The Component class |
component_id |
str |
The unique identifier for this component instance |
context_data |
Dict |
Dictionary of context data from Component.get_context_data() |
css_data |
Dict |
Dictionary of CSS data from Component.get_css_data() |
js_data |
Dict |
Dictionary of JavaScript data from Component.get_js_data() |
::: django_components.extension.ComponentExtension.on_component_input options: heading_level: 3 show_root_heading: true show_signature: true separate_signature: true show_symbol_type_heading: false show_symbol_type_toc: false show_if_no_docstring: true show_labels: false
Available data:
name | type | description |
---|---|---|
args |
List |
List of positional arguments passed to the component |
component |
Component |
The Component instance that received the input and is being rendered |
component_cls |
Type[Component] |
The Component class |
component_id |
str |
The unique identifier for this component instance |
context |
Context |
The Django template Context object |
kwargs |
Dict |
Dictionary of keyword arguments passed to the component |
slots |
Dict |
Dictionary of slot definitions |
::: django_components.extension.ComponentExtension.on_component_registered options: heading_level: 3 show_root_heading: true show_signature: true separate_signature: true show_symbol_type_heading: false show_symbol_type_toc: false show_if_no_docstring: true show_labels: false
Available data:
name | type | description |
---|---|---|
component_cls |
Type[Component] |
The registered Component class |
name |
str |
The name the component was registered under |
registry |
ComponentRegistry |
The registry the component was registered to |
::: django_components.extension.ComponentExtension.on_component_rendered options: show_root_heading: true show_signature: true separate_signature: true show_symbol_type_heading: false show_symbol_type_toc: false show_if_no_docstring: true show_labels: false
Available data:
name | type | description |
---|---|---|
component |
Component |
The Component instance that is being rendered |
component_cls |
Type[Component] |
The Component class |
component_id |
str |
The unique identifier for this component instance |
template |
str |
The rendered template |
::: django_components.extension.ComponentExtension.on_component_unregistered options: heading_level: 3 show_root_heading: true show_signature: true separate_signature: true show_symbol_type_heading: false show_symbol_type_toc: false show_if_no_docstring: true show_labels: false
Available data:
name | type | description |
---|---|---|
component_cls |
Type[Component] |
The unregistered Component class |
name |
str |
The name the component was registered under |
registry |
ComponentRegistry |
The registry the component was unregistered from |
::: django_components.extension.ComponentExtension.on_registry_created options: heading_level: 3 show_root_heading: true show_signature: true separate_signature: true show_symbol_type_heading: false show_symbol_type_toc: false show_if_no_docstring: true show_labels: false
Available data:
name | type | description |
---|---|---|
registry |
ComponentRegistry |
The created ComponentRegistry instance |
::: django_components.extension.ComponentExtension.on_registry_deleted options: heading_level: 3 show_root_heading: true show_signature: true separate_signature: true show_symbol_type_heading: false show_symbol_type_toc: false show_if_no_docstring: true show_labels: false
Available data:
name | type | description |
---|---|---|
registry |
ComponentRegistry |
The to-be-deleted ComponentRegistry instance |
Objects
::: django_components.extension.OnComponentClassCreatedContext options: heading_level: 3 show_if_no_docstring: true
::: django_components.extension.OnComponentClassDeletedContext options: heading_level: 3 show_if_no_docstring: true
::: django_components.extension.OnComponentDataContext options: heading_level: 3 show_if_no_docstring: true
::: django_components.extension.OnComponentInputContext options: heading_level: 3 show_if_no_docstring: true
::: django_components.extension.OnComponentRegisteredContext options: heading_level: 3 show_if_no_docstring: true
::: django_components.extension.OnComponentUnregisteredContext options: heading_level: 3 show_if_no_docstring: true
::: django_components.extension.OnRegistryCreatedContext options: heading_level: 3 show_if_no_docstring: true
::: django_components.extension.OnRegistryDeletedContext options: heading_level: 3 show_if_no_docstring: true