| 1 |
URLs |
| 2 |
==== |
| 3 |
|
| 4 |
You can pass the URL parameters to menu items in three ways. |
| 5 |
|
| 6 |
Raw URLs |
| 7 |
-------- |
| 8 |
|
| 9 |
A hard-coded url: |
| 10 |
|
| 11 |
.. code:: python |
| 12 |
|
| 13 |
"url": '/some-path/to-feature' |
| 14 |
|
| 15 |
Reversible URLs |
| 16 |
--------------- |
| 17 |
|
| 18 |
An url that can be reversed with the `reverse` method: |
| 19 |
|
| 20 |
.. code:: python |
| 21 |
|
| 22 |
"url": 'named_url' |
| 23 |
|
| 24 |
URL with args or kwargs |
| 25 |
----------------------- |
| 26 |
|
| 27 |
e.g. If you have an url with kwargs like this: |
| 28 |
|
| 29 |
.. code:: python |
| 30 |
|
| 31 |
url(r'^update/(?P<pk>\d+)/$', SomeView.as_view(), name='update'), |
| 32 |
|
| 33 |
you can pass the url as follows: |
| 34 |
|
| 35 |
.. code:: python |
| 36 |
|
| 37 |
"url": {"viewname": 'update', "kwargs": {"pk": 1}} |
| 38 |
|
| 39 |
In fact, you can pass any of the parameters of the reverse method through the dictionary |
| 40 |
|
| 41 |
For Django 1.10 the reverse method sign is: ``reverse(viewname, urlconf=None, args=None, kwargs=None, current_app=None)`` |
| 42 |
|