From f5e1d72de2e111ef2449f858b672c9cf4ecbb9ff Mon Sep 17 00:00:00 2001 From: Thijs van Dien Date: Sat, 7 Nov 2015 15:50:43 +0100 Subject: [PATCH] [1.9.x] Fixed #25473 -- Changed underscores in url() names to dashes in docs. To improve consistency, sample URL names that had underscores in them now use dashes instead. That excludes URL names that have some relation to the code, such as those generated by the admin. Thanks guettli for reporting this. Backport of 1679472165e840aef4c8c9ece2fbf4620b87beab from master --- AUTHORS | 1 + docs/ref/urlresolvers.txt | 4 ++-- docs/topics/class-based-views/generic-editing.txt | 6 +++--- docs/topics/i18n/translation.txt | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/AUTHORS b/AUTHORS index 74586b68baf..5f032cf31b1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -685,6 +685,7 @@ answer newbie questions, and generally made Django that much better: Terry Huang thebjorn Thejaswi Puthraya + Thijs van Dien Thomas Chaumeny Thomas Güttler Thomas Kerpe diff --git a/docs/ref/urlresolvers.txt b/docs/ref/urlresolvers.txt index 8e9634c31d9..5bad660f484 100644 --- a/docs/ref/urlresolvers.txt +++ b/docs/ref/urlresolvers.txt @@ -18,12 +18,12 @@ For example, given the following ``url``:: from news import views - url(r'^archive/$', views.archive, name='news_archive') + url(r'^archive/$', views.archive, name='news-archive') you can use any of the following to reverse the URL:: # using the named URL - reverse('news_archive') + reverse('news-archive') # passing a callable object # (This is discouraged because you can't reverse namespaced views this way.) diff --git a/docs/topics/class-based-views/generic-editing.txt b/docs/topics/class-based-views/generic-editing.txt index 0ada8db42a0..4908d6a99e5 100644 --- a/docs/topics/class-based-views/generic-editing.txt +++ b/docs/topics/class-based-views/generic-editing.txt @@ -163,9 +163,9 @@ Finally, we hook these new views into the URLconf: urlpatterns = [ # ... - url(r'author/add/$', AuthorCreate.as_view(), name='author_add'), - url(r'author/(?P[0-9]+)/$', AuthorUpdate.as_view(), name='author_update'), - url(r'author/(?P[0-9]+)/delete/$', AuthorDelete.as_view(), name='author_delete'), + url(r'author/add/$', AuthorCreate.as_view(), name='author-add'), + url(r'author/(?P[0-9]+)/$', AuthorUpdate.as_view(), name='author-update'), + url(r'author/(?P[0-9]+)/delete/$', AuthorDelete.as_view(), name='author-delete'), ] .. note:: diff --git a/docs/topics/i18n/translation.txt b/docs/topics/i18n/translation.txt index 6c63a2b71a5..88dfc131c14 100644 --- a/docs/topics/i18n/translation.txt +++ b/docs/topics/i18n/translation.txt @@ -1352,7 +1352,7 @@ prepend the current active language code to all url patterns defined within from sitemap.views import sitemap urlpatterns = [ - url(r'^sitemap\.xml$', sitemap, name='sitemap_xml'), + url(r'^sitemap\.xml$', sitemap, name='sitemap-xml'), ] news_patterns = ([ @@ -1374,7 +1374,7 @@ function. Example:: from django.utils.translation import activate >>> activate('en') - >>> reverse('sitemap_xml') + >>> reverse('sitemap-xml') '/sitemap.xml' >>> reverse('news:index') '/en/news/' @@ -1410,7 +1410,7 @@ URL patterns can also be marked translatable using the from sitemaps.views import sitemap urlpatterns = [ - url(r'^sitemap\.xml$', sitemap, name='sitemap_xml'), + url(r'^sitemap\.xml$', sitemap, name='sitemap-xml'), ] news_patterns = ([