mirror of
https://github.com/django-components/django-components.git
synced 2025-08-30 18:57:20 +00:00
feat: on_render (#1231)
* feat: on_render * docs: fix typos * refactor: fix linter errors * refactor: make `error` in on_render_after optional to fix benchmarks * refactor: benchmark attempt 2 * refactor: fix linter errors * refactor: fix formatting
This commit is contained in:
parent
46e524e37d
commit
eceebb9696
24 changed files with 1793 additions and 417 deletions
|
@ -135,13 +135,13 @@ Thus, you can check where a slot was filled from by printing it out:
|
|||
|
||||
```python
|
||||
class MyComponent(Component):
|
||||
def on_render_before(self, *args, **kwargs):
|
||||
def on_render_before(self, context: Context, template: Optional[Template]):
|
||||
print(self.slots)
|
||||
```
|
||||
|
||||
might print:
|
||||
|
||||
```txt
|
||||
```python
|
||||
{
|
||||
'content': <Slot component_name='layout' slot_name='content'>,
|
||||
'header': <Slot component_name='my_page' slot_name='header'>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue