mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #26013 -- Moved django.core.urlresolvers to django.urls.
Thanks to Tim Graham for the review.
This commit is contained in:
parent
df3d5b1d73
commit
16411b8400
117 changed files with 961 additions and 922 deletions
|
@ -71,7 +71,7 @@ create a real version. Add the following to ``polls/views.py``:
|
|||
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
|
||||
from .models import Choice, Question
|
||||
# ...
|
||||
|
@ -124,13 +124,13 @@ This code includes a few things we haven't covered yet in this tutorial:
|
|||
POST data. This tip isn't specific to Django; it's just good Web
|
||||
development practice.
|
||||
|
||||
* We are using the :func:`~django.core.urlresolvers.reverse` function in the
|
||||
* We are using the :func:`~django.urls.reverse` function in the
|
||||
:class:`~django.http.HttpResponseRedirect` constructor in this example.
|
||||
This function helps avoid having to hardcode a URL in the view function.
|
||||
It is given the name of the view that we want to pass control to and the
|
||||
variable portion of the URL pattern that points to that view. In this
|
||||
case, using the URLconf we set up in :doc:`Tutorial 3 </intro/tutorial03>`,
|
||||
this :func:`~django.core.urlresolvers.reverse` call will return a string like
|
||||
this :func:`~django.urls.reverse` call will return a string like
|
||||
::
|
||||
|
||||
'/polls/3/results/'
|
||||
|
@ -264,7 +264,7 @@ views and use Django's generic views instead. To do so, open the
|
|||
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
from django.views import generic
|
||||
|
||||
from .models import Choice, Question
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue