If your urls.py
file consists of the following:
urlpatterns = patterns('', url(r'^$', 'views.recent', name='recent'), url(r'^recent/(?P<page>\d+)$', 'views.recent', name='recent') )
using python manage.py shell
in the project directory do the following:
>>> from django.core.urlresolvers import reverse >>> reverse('recent') '/recent'
you can pass certain parameters by passing a list as args
or a dictionary as kwargs
>>> reverse('recent', args=[1]) '/recent/1' >>> reverse('recent', kwargs={'page': 2}) '/recent/2'
check the doc on the way back for your specific version of Django.
Yeray Diaz Diaz Mar 03 '14 at 9:59 a.m. 2014-03-03 09:59
source share