url
Admin
(from The Definitive Guide to Django page 118, Special-Casing Views):
('^([^/]+)/([^/]+)/add/$', my_other_view),
…(if I typed it right)… this will (apparently) match URLs like
/myblog/entries/add/
and /auth/groups/add/
.
|
start of the string |
|
Match any character that is NOT a slash… |
|
Between one and unlimited times. |
Home Page (root)
(r'^/?$', temporary_home_page),
Numbers and arguments
(r'^time/plus/(\d{1,2})/$', my_other_view),
|
To match any number of digits. |
|
To match one or two digits (maximum 99). |
|
Enclose arguments you want to define within brackets. |
Parameters (and Name)
url(r'^artist/$',
feature_index,
{ 'category': 'artist', },
name='feature_index_artist'),
Note: See (My) Coding Standards, URL for the preferred way of using url
.
Slug
For a nice URL sample, combining a date with a slug, see urls.py from simple_url_monitor.
(r'^news/(?P<slug>[-\w]+)/$', get_time_line),