[1.8.x] Fixed #24700 -- Added dash to slug regex in http docs

Backport of 269a5dbdd3 from master
This commit is contained in:
Marcus Pennington 2015-04-24 17:05:25 +01:00 committed by Tim Graham
parent 61e902c4c4
commit 2a334d7985
1 changed files with 5 additions and 5 deletions

View File

@ -320,10 +320,10 @@ prefix is used repeatedly. For example, consider this URLconf::
from . import views
urlpatterns = [
url(r'^(?P<page_slug>\w+)-(?P<page_id>\w+)/history/$', views.history),
url(r'^(?P<page_slug>\w+)-(?P<page_id>\w+)/edit/$', views.edit),
url(r'^(?P<page_slug>\w+)-(?P<page_id>\w+)/discuss/$', views.discuss),
url(r'^(?P<page_slug>\w+)-(?P<page_id>\w+)/permissions/$', views.permissions),
url(r'^(?P<page_slug>[\w-]+)-(?P<page_id>\w+)/history/$', views.history),
url(r'^(?P<page_slug>[\w-]+)-(?P<page_id>\w+)/edit/$', views.edit),
url(r'^(?P<page_slug>[\w-]+)-(?P<page_id>\w+)/discuss/$', views.discuss),
url(r'^(?P<page_slug>[\w-]+)-(?P<page_id>\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<page_slug>\w+)-(?P<page_id>\w+)/', include([
url(r'^(?P<page_slug>[\w-]+)-(?P<page_id>\w+)/', include([
url(r'^history/$', views.history),
url(r'^edit/$', views.edit),
url(r'^discuss/$', views.discuss),