mirror of
https://github.com/django-components/django-components.git
synced 2025-10-17 17:27:13 +00:00
feat: allow to set query and fragment on get_component_url (#1160)
This commit is contained in:
parent
bf7a204e92
commit
c69980493d
6 changed files with 102 additions and 5 deletions
|
@ -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
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue