mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #26013 -- Moved django.core.urlresolvers to django.urls.
Thanks to Tim Graham for the review.
This commit is contained in:
committed by
Tim Graham
parent
df3d5b1d73
commit
16411b8400
@@ -103,9 +103,8 @@ This example is equivalent to::
|
||||
* A model: the model's :meth:`~django.db.models.Model.get_absolute_url()`
|
||||
function will be called.
|
||||
|
||||
* A view name, possibly with arguments: :func:`urlresolvers.reverse
|
||||
<django.core.urlresolvers.reverse>` will be used to reverse-resolve the
|
||||
name.
|
||||
* A view name, possibly with arguments: :func:`~django.urls.reverse` will be
|
||||
used to reverse-resolve the name.
|
||||
|
||||
* An absolute or relative URL, which will be used as-is for the redirect
|
||||
location.
|
||||
@@ -131,7 +130,7 @@ You can use the :func:`redirect` function in a number of ways.
|
||||
|
||||
2. By passing the name of a view and optionally some positional or
|
||||
keyword arguments; the URL will be reverse resolved using the
|
||||
:func:`~django.core.urlresolvers.reverse` method::
|
||||
:func:`~django.urls.reverse` method::
|
||||
|
||||
def my_view(request):
|
||||
...
|
||||
|
||||
@@ -533,8 +533,7 @@ layers where URLs are needed:
|
||||
|
||||
* In templates: Using the :ttag:`url` template tag.
|
||||
|
||||
* In Python code: Using the :func:`django.core.urlresolvers.reverse`
|
||||
function.
|
||||
* In Python code: Using the :func:`~django.urls.reverse` function.
|
||||
|
||||
* In higher level code related to handling of URLs of Django model instances:
|
||||
The :meth:`~django.db.models.Model.get_absolute_url` method.
|
||||
@@ -571,7 +570,7 @@ You can obtain these in template code by using:
|
||||
|
||||
Or in Python code::
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
from django.http import HttpResponseRedirect
|
||||
|
||||
def redirect_to_year(request):
|
||||
@@ -671,8 +670,8 @@ the fully qualified name into parts and then tries the following lookup:
|
||||
|
||||
2. If there is a current application defined, Django finds and returns the URL
|
||||
resolver for that instance. The current application can be specified with
|
||||
the ``current_app`` argument to the
|
||||
:func:`~django.core.urlresolvers.reverse()` function.
|
||||
the ``current_app`` argument to the :func:`~django.urls.reverse()`
|
||||
function.
|
||||
|
||||
The :ttag:`url` template tag uses the namespace of the currently resolved
|
||||
view as the current application in a
|
||||
|
||||
Reference in New Issue
Block a user