docs: update auto-gen'd docs to show signals reference page (#926)

This commit is contained in:
Juro Oravec 2025-01-22 16:32:00 +01:00 committed by GitHub
parent 914576e681
commit 6ccc2fe0f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 164 additions and 103 deletions

41
docs/reference/signals.md Normal file
View file

@ -0,0 +1,41 @@
<!-- Autogenerated by reference.py -->
# Signals
Below are the signals that are sent by or during the use of django-components.
## template_rendered
Django's [`template_rendered`](https://docs.djangoproject.com/en/5.1/ref/signals/#template-rendered) signal.
This signal is sent when a template is rendered.
Django-components triggers this signal when a component is rendered. If there are nested components,
the signal is triggered for each component.
Import from django as `django.test.signals.template_rendered`.
```python
from django.test.signals import template_rendered
# Setup a callback function
def my_callback(sender, **kwargs):
...
template_rendered.connect(my_callback)
class MyTable(Component):
template = """
<table>
<tr>
<th>Header</th>
</tr>
<tr>
<td>Cell</td>
</tr>
"""
# This will trigger the signal
MyTable().render()
```