mirror of
https://github.com/django-components/django-components.git
synced 2025-09-25 06:59:10 +00:00
docs: add settings info to README
This commit is contained in:
parent
623a5fe365
commit
f28e5695f4
1 changed files with 23 additions and 0 deletions
23
README.md
23
README.md
|
@ -20,6 +20,8 @@ Read on to learn about the details!
|
||||||
|
|
||||||
## Release notes
|
## Release notes
|
||||||
|
|
||||||
|
**Version 0.67** CHANGED the default way how context variables are resolved in slots. See the [documentation](#isolate-components-slots) for more details.
|
||||||
|
|
||||||
🚨📢 **Version 0.5** CHANGES THE SYNTAX for components. `component_block` is now `component`, and `component` blocks need an ending `endcomponent` tag. The new `python manage.py upgradecomponent` command can be used to upgrade a directory (use --path argument to point to each dir) of components to the new syntax automatically.
|
🚨📢 **Version 0.5** CHANGES THE SYNTAX for components. `component_block` is now `component`, and `component` blocks need an ending `endcomponent` tag. The new `python manage.py upgradecomponent` command can be used to upgrade a directory (use --path argument to point to each dir) of components to the new syntax automatically.
|
||||||
|
|
||||||
This change is done to simplify the API in anticipation of a 1.0 release of django_components. After 1.0 we intend to be stricter with big changes like this in point releases.
|
This change is done to simplify the API in anticipation of a 1.0 release of django_components. After 1.0 we intend to be stricter with big changes like this in point releases.
|
||||||
|
@ -704,6 +706,27 @@ COMPONENTS = {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Isolate components' slots
|
||||||
|
|
||||||
|
What variables should be available from inside a component slot?
|
||||||
|
|
||||||
|
By default, variables inside component slots are preferentially taken from the root context.
|
||||||
|
This is similar to [how Vue renders slots](https://vuejs.org/guide/components/slots.html#render-scope),
|
||||||
|
except that, if variable is not found in the root, then the surrounding context is searched too.
|
||||||
|
|
||||||
|
You can change this with the `slot_contet_behavior` setting. Options are:
|
||||||
|
- `"prefer_root"` - Default - as described above
|
||||||
|
- `"isolated"` - Same behavior as Vue - variable is taken ONLY from the root context
|
||||||
|
- `"allow_override"` - slot context variables are taken from its surroundings (default before v0.67)
|
||||||
|
|
||||||
|
```python
|
||||||
|
COMPONENTS = {
|
||||||
|
"slot_context_behavior": "isolated",
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For further details and examples, see [SlotContextBehavior](https://github.com/EmilStenstrom/django-components/blob/master/src/django_components/app_settings.py#L12).
|
||||||
|
|
||||||
## Logging and debugging
|
## Logging and debugging
|
||||||
|
|
||||||
Django components supports [logging with Django](https://docs.djangoproject.com/en/5.0/howto/logging/#logging-how-to). This can help with troubleshooting.
|
Django components supports [logging with Django](https://docs.djangoproject.com/en/5.0/howto/logging/#logging-how-to). This can help with troubleshooting.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue