﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22781	Improve named regular-expression groups example to capture URL bits	Pablo Oubiña	nobody	"Hi folks!

Documentation shows [https://docs.djangoproject.com/en/dev/topics/http/urls/#named-groups]:


{{{
from django.conf.urls import url

urlpatterns = [
    url(r'^articles/2003/$', 'news.views.special_case_2003'),
    url(r'^articles/(?P<year>[0-9]{4})/$', 'news.views.year_archive'),
    url(r'^articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/$', 'news.views.month_archive'),
    url(r'^articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/(?P<day>[0-9]{2})/$', 'news.views.article_detail'),
]
}}}


I think this would be more flexible:


{{{
from django.conf.urls import url

urlpatterns = [
    url(r'^articles/2003/$', 'news.views.special_case_2003'),
    url(r'^articles/(?P<year>[0-9]{4})/$', 'news.views.year_archive'),
    url(r'^articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/$', 'news.views.month_archive'),
    url(r'^articles/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/(?P<day>[0-9]{1,2})/$', 'news.views.article_detail'),
]
}}}

"	Cleanup/optimization	closed	Documentation	1.6	Normal	wontfix	url, regular, expression, regex, group		Unreviewed	0	0	0	0	0	0
