Fixed #26013 -- Moved django.core.urlresolvers to django.urls.

Thanks to Tim Graham for the review.
This commit is contained in:
Marten Kenbeek 2015-12-30 16:51:16 +01:00 committed by Tim Graham
parent df3d5b1d73
commit 16411b8400
117 changed files with 961 additions and 922 deletions

View file

@ -98,7 +98,7 @@ First we need to add :meth:`~django.db.models.Model.get_absolute_url()` to our
.. snippet::
:filename: models.py
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.db import models
class Author(models.Model):
@ -115,7 +115,7 @@ here; we don't have to write any logic ourselves:
:filename: views.py
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.core.urlresolvers import reverse_lazy
from django.urls import reverse_lazy
from myapp.models import Author
class AuthorCreate(CreateView):
@ -131,8 +131,8 @@ here; we don't have to write any logic ourselves:
success_url = reverse_lazy('author-list')
.. note::
We have to use :func:`~django.core.urlresolvers.reverse_lazy` here, not
just ``reverse`` as the urls are not loaded when the file is imported.
We have to use :func:`~django.urls.reverse_lazy` here, not just
``reverse()`` as the urls are not loaded when the file is imported.
The ``fields`` attribute works the same way as the ``fields`` attribute on the
inner ``Meta`` class on :class:`~django.forms.ModelForm`. Unless you define the

View file

@ -225,7 +225,7 @@ We'll demonstrate this with the ``Author`` model we used in the
:filename: views.py
from django.http import HttpResponseForbidden, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.views.generic import View
from django.views.generic.detail import SingleObjectMixin
from books.models import Author
@ -445,7 +445,7 @@ Our new ``AuthorDetail`` looks like this::
from django import forms
from django.http import HttpResponseForbidden
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.views.generic import DetailView
from django.views.generic.edit import FormMixin
from books.models import Author
@ -541,7 +541,7 @@ can find the author we're talking about, and we have to remember to set
``template_name`` to ensure that form errors will render the same
template as ``AuthorDisplay`` is using on ``GET``::
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.http import HttpResponseForbidden
from django.views.generic import FormView
from django.views.generic.detail import SingleObjectMixin