diff options
| author | Sjoerd Job Postmus <sjoerdjob@sjec.nl> | 2016-10-20 19:29:04 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-09-20 18:04:42 -0400 |
| commit | df41b5a05d4e00e80e73afe629072e37873e767a (patch) | |
| tree | baaf71ae695e2d3af604ea0d663284cb406c71e4 /docs/releases | |
| parent | c4c128d67c7dc2830631c6859a204c9d259f1fb1 (diff) | |
Fixed #28593 -- Added a simplified URL routing syntax per DEP 0201.
Thanks Aymeric Augustin for shepherding the DEP and patch review.
Thanks Marten Kenbeek and Tim Graham for contributing to the code.
Thanks Tom Christie, Shai Berger, and Tim Graham for the docs.
Diffstat (limited to 'docs/releases')
| -rw-r--r-- | docs/releases/1.4.txt | 5 | ||||
| -rw-r--r-- | docs/releases/1.9.txt | 6 | ||||
| -rw-r--r-- | docs/releases/2.0.txt | 26 |
3 files changed, 31 insertions, 6 deletions
diff --git a/docs/releases/1.4.txt b/docs/releases/1.4.txt index 3a8b52db57..13cff1f0b3 100644 --- a/docs/releases/1.4.txt +++ b/docs/releases/1.4.txt @@ -1229,9 +1229,8 @@ disable this backward-compatibility shim and deprecation warning. ``django.conf.urls.defaults`` ----------------------------- -Until Django 1.3, the functions :func:`~django.conf.urls.include`, -``patterns()`` and :func:`~django.conf.urls.url` plus -:data:`~django.conf.urls.handler404`, :data:`~django.conf.urls.handler500` +Until Django 1.3, the ``include()``, ``patterns()``, and ``url()`` functions, +plus :data:`~django.conf.urls.handler404` and :data:`~django.conf.urls.handler500` were located in a ``django.conf.urls.defaults`` module. In Django 1.4, they live in :mod:`django.conf.urls`. diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt index 9d0d9efd93..2b012191cd 100644 --- a/docs/releases/1.9.txt +++ b/docs/releases/1.9.txt @@ -657,7 +657,7 @@ URLs * The application namespace can now be set using an ``app_name`` attribute on the included module or object. It can also be set by passing a 2-tuple of (<list of patterns>, <application namespace>) as the first argument to - :func:`~django.conf.urls.include`. + ``include()``. * System checks have been added for common URL pattern mistakes. @@ -1233,8 +1233,8 @@ extending. This change necessitated a new template loader API. The old Details about the new API can be found :ref:`in the template loader documentation <custom-template-loaders>`. -Passing a 3-tuple or an ``app_name`` to :func:`~django.conf.urls.include()` ---------------------------------------------------------------------------- +Passing a 3-tuple or an ``app_name`` to ``include()`` +----------------------------------------------------- The instance namespace part of passing a tuple as an argument to ``include()`` has been replaced by passing the ``namespace`` argument to ``include()``. For diff --git a/docs/releases/2.0.txt b/docs/releases/2.0.txt index b45e494800..457e69ea9e 100644 --- a/docs/releases/2.0.txt +++ b/docs/releases/2.0.txt @@ -46,6 +46,32 @@ be compatible with Django 2.0. What's new in Django 2.0 ======================== +Simplified URL routing syntax +----------------------------- + +The new :func:`django.urls.path()` function allows a simpler, more readable URL +routing syntax. For example, this example from previous Django releases:: + + url(r'^articles/(?P<year>[0-9]{4})/$', views.year_archive), + +could be written as:: + + path('articles/<int:year>/', views.year_archive), + +The new syntax supports type coercion of URL parameters. In the example, the +view will receive the ``year`` keyword argument as an integer rather than as +a string. + +The ``django.conf.urls.url()`` function from previous versions is now available +as :func:`django.urls.re_path`, however, the old location remains for backwards +compatibility, without an imminent deprecation. The old +``django.conf.urls.include()`` function is now importable from ``django.urls`` +so you can use ``from django.urls import include, path, re_path`` in your +URLconfs. + +The :doc:`/topics/http/urls` document is rewritten to feature the new syntax +and provide more details. + Mobile-friendly ``contrib.admin`` --------------------------------- |
