mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +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
|
@ -1252,7 +1252,7 @@ subclass::
|
|||
For example::
|
||||
|
||||
from django.contrib import admin
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.urls import reverse
|
||||
|
||||
class PersonAdmin(admin.ModelAdmin):
|
||||
def view_on_site(self, obj):
|
||||
|
@ -2883,9 +2883,9 @@ So - if you wanted to get a reference to the Change view for a particular
|
|||
``Choice`` object (from the polls application) in the default admin, you would
|
||||
call::
|
||||
|
||||
>>> from django.core import urlresolvers
|
||||
>>> from django.urls import reverse
|
||||
>>> c = Choice.objects.get(...)
|
||||
>>> change_url = urlresolvers.reverse('admin:polls_choice_change', args=(c.id,))
|
||||
>>> change_url = reverse('admin:polls_choice_change', args=(c.id,))
|
||||
|
||||
This will find the first registered instance of the admin application
|
||||
(whatever the instance name), and resolve to the view for changing
|
||||
|
@ -2896,8 +2896,7 @@ that instance as a ``current_app`` hint to the reverse call. For example,
|
|||
if you specifically wanted the admin view from the admin instance named
|
||||
``custom``, you would need to call::
|
||||
|
||||
>>> change_url = urlresolvers.reverse('admin:polls_choice_change',
|
||||
... args=(c.id,), current_app='custom')
|
||||
>>> change_url = reverse('admin:polls_choice_change', args=(c.id,), current_app='custom')
|
||||
|
||||
For more details, see the documentation on :ref:`reversing namespaced URLs
|
||||
<topics-http-reversing-url-namespaces>`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue