File: urls.rst

package info (click to toggle)
django-menu-generator-ng 1.2.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 276 kB
  • sloc: python: 729; makefile: 17
file content (42 lines) | stat: -rw-r--r-- 803 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
URLs
====

You can pass the URL parameters to menu items in three ways.

Raw URLs
--------

A hard-coded url:

.. code:: python

    "url": '/some-path/to-feature'

Reversible URLs
---------------

An url that can be reversed with the `reverse` method:

.. code:: python

    "url": 'named_url'

URL with args or kwargs
-----------------------

e.g. If you have an url with kwargs like this:

.. code:: python

    url(r'^update/(?P<pk>\d+)/$', SomeView.as_view(), name='update'),

you can pass the url as follows:

.. code:: python

    "url": {"viewname": 'update', "kwargs": {"pk": 1}}

In fact, you can pass any of the parameters of the reverse method through the dictionary

For Django 1.10 the reverse method sign is: ``reverse(viewname, urlconf=None, args=None, kwargs=None, current_app=None)``