From 2a334d79851944d3ba6752b3486e4274d2150c29 Mon Sep 17 00:00:00 2001 From: Marcus Pennington Date: Fri, 24 Apr 2015 17:05:25 +0100 Subject: [PATCH] [1.8.x] Fixed #24700 -- Added dash to slug regex in http docs Backport of 269a5dbdd37362e27b2bb3bf3a600ffd5ea2c3bb from master --- docs/topics/http/urls.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/topics/http/urls.txt b/docs/topics/http/urls.txt index f4cf4b6029..2fd52b69f3 100644 --- a/docs/topics/http/urls.txt +++ b/docs/topics/http/urls.txt @@ -320,10 +320,10 @@ prefix is used repeatedly. For example, consider this URLconf:: from . import views urlpatterns = [ - url(r'^(?P\w+)-(?P\w+)/history/$', views.history), - url(r'^(?P\w+)-(?P\w+)/edit/$', views.edit), - url(r'^(?P\w+)-(?P\w+)/discuss/$', views.discuss), - url(r'^(?P\w+)-(?P\w+)/permissions/$', views.permissions), + url(r'^(?P[\w-]+)-(?P\w+)/history/$', views.history), + url(r'^(?P[\w-]+)-(?P\w+)/edit/$', views.edit), + url(r'^(?P[\w-]+)-(?P\w+)/discuss/$', views.discuss), + url(r'^(?P[\w-]+)-(?P\w+)/permissions/$', views.permissions), ] We can improve this by stating the common path prefix only once and grouping @@ -333,7 +333,7 @@ the suffixes that differ:: from . import views urlpatterns = [ - url(r'^(?P\w+)-(?P\w+)/', include([ + url(r'^(?P[\w-]+)-(?P\w+)/', include([ url(r'^history/$', views.history), url(r'^edit/$', views.edit), url(r'^discuss/$', views.discuss),