summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-08-12 10:54:42 -0400
committerTim Graham <timograham@gmail.com>2014-08-12 13:15:40 -0400
commita9fd740d22bc4fed5fdb280c036618000ee13df1 (patch)
tree18a58170b4633f22e5869db2c2ed086245ed415c /docs/ref
parent2003cb23d4f1b3be717855d41b562d4d5cfebe99 (diff)
Fixed #23276 -- Deprecated passing views as strings to url().
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/admin/index.txt10
-rw-r--r--docs/ref/contrib/sitemaps.txt24
-rw-r--r--docs/ref/urls.txt18
3 files changed, 35 insertions, 17 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 8d69ac6e82..26c43b9743 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -2571,10 +2571,12 @@ your URLconf. Specifically, add these four patterns:
.. code-block:: python
- url(r'^admin/password_reset/$', 'django.contrib.auth.views.password_reset', name='admin_password_reset'),
- url(r'^admin/password_reset/done/$', 'django.contrib.auth.views.password_reset_done', name='password_reset_done'),
- url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm', name='password_reset_confirm'),
- url(r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete', name='password_reset_complete'),
+ from django.contrib.auth import views as auth_views
+
+ url(r'^admin/password_reset/$', auth_views.password_reset, name='admin_password_reset'),
+ url(r'^admin/password_reset/done/$', auth_views.password_reset_done, name='password_reset_done'),
+ url(r'^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$', auth_views.password_reset_confirm, name='password_reset_confirm'),
+ url(r'^reset/done/$', auth_views.password_reset_complete, name='password_reset_complete'),
(This assumes you've added the admin at ``admin/`` and requires that you put
the URLs starting with ``^admin/`` before the line that includes the admin app
diff --git a/docs/ref/contrib/sitemaps.txt b/docs/ref/contrib/sitemaps.txt
index 42552e8733..f8a21f3d01 100644
--- a/docs/ref/contrib/sitemaps.txt
+++ b/docs/ref/contrib/sitemaps.txt
@@ -54,8 +54,10 @@ Initialization
To activate sitemap generation on your Django site, add this line to your
:doc:`URLconf </topics/http/urls>`::
- url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap',
- {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap')
+ from django.contrib.sitemaps.views import sitemap
+
+ url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps},
+ name='django.contrib.sitemaps.views.sitemap')
This tells Django to build a sitemap when a client accesses :file:`/sitemap.xml`.
@@ -277,6 +279,7 @@ Here's an example of a :doc:`URLconf </topics/http/urls>` using both::
from django.conf.urls import url
from django.contrib.sitemaps import FlatPageSitemap, GenericSitemap
+ from django.contrib.sitemaps.views import sitemap
from blog.models import Entry
info_dict = {
@@ -294,8 +297,8 @@ Here's an example of a :doc:`URLconf </topics/http/urls>` using both::
# ...
# the sitemap
- url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap',
- {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap'),
+ url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps},
+ name='django.contrib.sitemaps.views.sitemap'),
]
.. _URLconf: ../url_dispatch/
@@ -311,8 +314,11 @@ the sitemap. For example::
# sitemaps.py
from django.contrib import sitemaps
+ from django.contrib.sitemaps.views import sitemap
from django.core.urlresolvers import reverse
+ from . import views
+
class StaticViewSitemap(sitemaps.Sitemap):
priority = 0.5
changefreq = 'daily'
@@ -332,12 +338,12 @@ the sitemap. For example::
}
urlpatterns = [
- url(r'^$', 'views.main', name='main'),
- url(r'^about/$', 'views.about', name='about'),
- url(r'^license/$', 'views.license', name='license'),
+ url(r'^$', views.main, name='main'),
+ url(r'^about/$', views.about, name='about'),
+ url(r'^license/$', views.license, name='license'),
# ...
- url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap',
- {'sitemaps': sitemaps}, name='django.contrib.sitemaps.views.sitemap')
+ url(r'^sitemap\.xml$', sitemap, {'sitemaps': sitemaps},
+ name='django.contrib.sitemaps.views.sitemap')
]
diff --git a/docs/ref/urls.txt b/docs/ref/urls.txt
index be09777b40..222f41a76e 100644
--- a/docs/ref/urls.txt
+++ b/docs/ref/urls.txt
@@ -78,7 +78,7 @@ The ``optional_dictionary`` and ``optional_name`` parameters are described in
static()
--------
-.. function:: static.static(prefix, view='django.views.static.serve', **kwargs)
+.. function:: static.static(prefix, view=django.views.static.serve, **kwargs)
Helper function to return a URL pattern for serving files in debug mode::
@@ -89,6 +89,11 @@ Helper function to return a URL pattern for serving files in debug mode::
# ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+.. versionchanged:: 1.8
+
+ The ``view`` argument changed from a string
+ (``'django.views.static.serve'``) to the function.
+
url()
-----
@@ -111,9 +116,14 @@ function or method. See :ref:`views-extra-options` for an example.
See :ref:`Naming URL patterns <naming-url-patterns>` for why the ``name``
parameter is useful.
-The ``prefix`` parameter has the same meaning as the first argument to
-``patterns()`` and is only relevant when you're passing a string as the
-``view`` parameter.
+.. deprecated:: 1.8
+
+ Support for string ``view`` arguments is deprecated and will be removed in
+ Django 2.0. Pass the callable instead.
+
+ The ``prefix`` parameter has the same meaning as the first argument to
+ ``patterns()`` and is only relevant when you're passing a string as the
+ ``view`` parameter.
include()
---------