feat: allow to set query and fragment on get_component_url (#1160)

This commit is contained in:
Juro Oravec 2025-05-03 10:29:38 +02:00 committed by GitHub
parent bf7a204e92
commit c69980493d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 102 additions and 5 deletions

View file

@ -147,3 +147,16 @@ url = get_component_url(MyComponent)
```
This way you don't have to mix your app URLs with component URLs.
!!! info
If you need to pass query parameters or a fragment to the component URL, you can do so by passing the `query` and `fragment` arguments to [`get_component_url()`](../../../reference/api#django_components.get_component_url):
```py
url = get_component_url(
MyComponent,
query={"foo": "bar"},
fragment="baz",
)
# /components/ext/view/components/c1ab2c3?foo=bar#baz
```