[Django] #20640: `get_deleted_objects` causes an error if there is no change view.

6 views
Skip to first unread message

Django

unread,
Jun 22, 2013, 9:03:54 AM6/22/13
to django-...@googlegroups.com
#20640: `get_deleted_objects` causes an error if there is no change view.
-----------------------------------------+--------------------
Reporter: Keryn Knight <django@…> | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------------+--------------------
The
[https://github.com/django/django/blob/0268aba96bf91de3d172cd6ce2e44c3ce33ef7a0/django/contrib/admin/util.py#L111
format_callback] used for rendering the objects to be deleted on the
confirmation screen doesn't attempt to fail gracefully, if there is no
named URL fitting the "namespace:appname_modelname_change" - if
`get_urls()` is overridden on a `ModelAdmin` subclass to either change,
remove or replace the `change_view`, the delete page will never work due
to a `NoReverseMatch`.

Proposed solution: `NoReverseMatch` should be caught, and the format
should end up the same as if `has_admin` were `False`.

(note: link to GitHub above is to the latest revision in master, as I
write this.)

--
Ticket URL: <https://code.djangoproject.com/ticket/20640>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 13, 2013, 5:56:00 PM8/13/13
to django-...@googlegroups.com
#20640: `get_deleted_objects` causes an error if there is no change view.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner: nobody
<django@…> | Status: new
Type: Bug | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by koirikivi):

* needs_better_patch: => 0
* needs_docs: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

Created a test project and verified that the bug occurs.

--
Ticket URL: <https://code.djangoproject.com/ticket/20640#comment:1>

Django

unread,
Aug 17, 2013, 5:56:35 PM8/17/13
to django-...@googlegroups.com
#20640: `get_deleted_objects` causes an error if there is no change view.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner: koirikivi
<django@…> | Status: assigned

Type: Bug | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by koirikivi):

* owner: nobody => koirikivi
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/20640#comment:2>

Django

unread,
Aug 17, 2013, 7:51:25 PM8/17/13
to django-...@googlegroups.com
#20640: `get_deleted_objects` causes an error if there is no change view.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner: koirikivi
<django@…> | Status: assigned
Type: Bug | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0

Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by koirikivi):

* has_patch: 0 => 1


Comment:

Pull request: https://github.com/django/django/pull/1485

--
Ticket URL: <https://code.djangoproject.com/ticket/20640#comment:3>

Django

unread,
Aug 18, 2013, 11:23:08 AM8/18/13
to django-...@googlegroups.com
#20640: `get_deleted_objects` causes an error if there is no change view.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner: koirikivi
<django@…> | Status: assigned
Type: Bug | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by koirikivi):

Related issue (NoReverseMatch in changelist_view if the
"namespace:appname_modelname_change" url is removed): #20934

--
Ticket URL: <https://code.djangoproject.com/ticket/20640#comment:4>

Django

unread,
Aug 19, 2013, 12:02:11 PM8/19/13
to django-...@googlegroups.com
#20640: `get_deleted_objects` causes an error if there is no change view.
-------------------------------------+-------------------------------------
Reporter: Keryn Knight | Owner: koirikivi
<django@…> | Status: closed
Type: Bug | Version: master
Component: contrib.admin | Resolution: fixed

Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"3c0300405009b82b52fd15483371097221662fcd"]:
{{{
#!CommitTicketReference repository=""
revision="3c0300405009b82b52fd15483371097221662fcd"
Fixed #20640 -- Avoided NoReverseMatch in get_deleted_objects

The default delete action resulted in a NoReverseMatch if it were to
list any Model with a ModelAdmin with `get_urls` overridden to remove
the change url. Catching the error and not displaying the link in that
case, as was already done for models with no registered admins.

Thanks Keryn Knight for the report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/20640#comment:5>

Reply all
Reply to author
Forward
0 new messages