mirror of https://github.com/django/django.git
[1.8.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 1679472165
from master
This commit is contained in:
parent
bd55e80635
commit
78a28cca20
1
AUTHORS
1
AUTHORS
|
@ -657,6 +657,7 @@ answer newbie questions, and generally made Django that much better:
|
||||||
Terry Huang <terryh.tp@gmail.com>
|
Terry Huang <terryh.tp@gmail.com>
|
||||||
thebjorn <bp@datakortet.no>
|
thebjorn <bp@datakortet.no>
|
||||||
Thejaswi Puthraya <thejaswi.puthraya@gmail.com>
|
Thejaswi Puthraya <thejaswi.puthraya@gmail.com>
|
||||||
|
Thijs van Dien <thijs@vandien.net>
|
||||||
Thomas Chaumeny <t.chaumeny@gmail.com>
|
Thomas Chaumeny <t.chaumeny@gmail.com>
|
||||||
Thomas Güttler <hv@tbz-pariv.de>
|
Thomas Güttler <hv@tbz-pariv.de>
|
||||||
Thomas Kerpe <thomas@kerpe.net>
|
Thomas Kerpe <thomas@kerpe.net>
|
||||||
|
|
|
@ -18,12 +18,12 @@ For example, given the following ``url``::
|
||||||
|
|
||||||
from news import views
|
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::
|
you can use any of the following to reverse the URL::
|
||||||
|
|
||||||
# using the named URL
|
# using the named URL
|
||||||
reverse('news_archive')
|
reverse('news-archive')
|
||||||
|
|
||||||
# passing a callable object
|
# passing a callable object
|
||||||
# (This is discouraged because you can't reverse namespaced views this way.)
|
# (This is discouraged because you can't reverse namespaced views this way.)
|
||||||
|
|
|
@ -163,9 +163,9 @@ Finally, we hook these new views into the URLconf:
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
# ...
|
# ...
|
||||||
url(r'author/add/$', AuthorCreate.as_view(), name='author_add'),
|
url(r'author/add/$', AuthorCreate.as_view(), name='author-add'),
|
||||||
url(r'author/(?P<pk>[0-9]+)/$', AuthorUpdate.as_view(), name='author_update'),
|
url(r'author/(?P<pk>[0-9]+)/$', AuthorUpdate.as_view(), name='author-update'),
|
||||||
url(r'author/(?P<pk>[0-9]+)/delete/$', AuthorDelete.as_view(), name='author_delete'),
|
url(r'author/(?P<pk>[0-9]+)/delete/$', AuthorDelete.as_view(), name='author-delete'),
|
||||||
]
|
]
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
|
@ -1251,7 +1251,7 @@ prepend the current active language code to all url patterns defined within
|
||||||
from sitemap.views import sitemap
|
from sitemap.views import sitemap
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^sitemap\.xml$', sitemap, name='sitemap_xml'),
|
url(r'^sitemap\.xml$', sitemap, name='sitemap-xml'),
|
||||||
]
|
]
|
||||||
|
|
||||||
news_patterns = [
|
news_patterns = [
|
||||||
|
@ -1273,7 +1273,7 @@ function. Example::
|
||||||
from django.utils.translation import activate
|
from django.utils.translation import activate
|
||||||
|
|
||||||
>>> activate('en')
|
>>> activate('en')
|
||||||
>>> reverse('sitemap_xml')
|
>>> reverse('sitemap-xml')
|
||||||
'/sitemap.xml'
|
'/sitemap.xml'
|
||||||
>>> reverse('news:index')
|
>>> reverse('news:index')
|
||||||
'/en/news/'
|
'/en/news/'
|
||||||
|
@ -1309,7 +1309,7 @@ URL patterns can also be marked translatable using the
|
||||||
from sitemaps.views import sitemap
|
from sitemaps.views import sitemap
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^sitemap\.xml$', sitemap, name='sitemap_xml'),
|
url(r'^sitemap\.xml$', sitemap, name='sitemap-xml'),
|
||||||
]
|
]
|
||||||
|
|
||||||
news_patterns = [
|
news_patterns = [
|
||||||
|
|
Loading…
Reference in New Issue