Adding request arg to render (#817)

Co-authored-by: Laurence Hole <laurence@safi.co>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Laurence Hole 2024-12-10 12:28:34 +00:00 committed by GitHub
parent 3f2d92f252
commit dfd4187192
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 90 additions and 6 deletions

View file

@ -74,6 +74,12 @@ Component.render(
- NOTE: In "isolated" mode, context is NOT accessible, and data MUST be passed via
component's args and kwargs.
- _`request`_ - A Django request object. This is used to enable Django template `context_processors` to run,
allowing for template tags like `{% csrf_token %}` and variables like `{{ debug }}`.
- Similar behavior can be achieved with [provide / inject](#how-to-use-provide--inject).
- This is used internally to convert `context` to a RequestContext. It does nothing if `context` is already
a `Context` instance.
### `SlotFunc`
When rendering components with slots in `render` or `render_to_response`, you can pass either a string or a function.