[Django] #17962: Django Admin delete_view could benefit from extension points

15 views
Skip to first unread message

Django

unread,
Mar 23, 2012, 1:13:52 PM3/23/12
to django-...@googlegroups.com
#17962: Django Admin delete_view could benefit from extension points
-------------------------------+--------------------
Reporter: gcc | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: SVN
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I want to increase control over who can delete what objects using the
admin interface.

`delete_view` calls `has_delete_permission()`, which is fine, but then it
calls `get_deleted_objects()` from `django.contrib.admin.util`.

This is very hard to override without monkey-patching
`get_deleted_objects()`, because it requires replacing the whole of
`delete_view` just to change one line.

I propose calling a member method `get_deleted_objects()`, which by
default just calls the one from `util`, to make it easy to override this
behaviour.

I've attached a patch without tests, because the existing tests should
check that this doesn't break anything.

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

Django

unread,
Jun 8, 2012, 10:29:39 PM6/8/12
to django-...@googlegroups.com
#17962: Django Admin delete_view could benefit from extension points
-------------------------------+------------------------------------
Reporter: gcc | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by lukeplant):

* needs_better_patch: => 0
* component: Uncategorized => contrib.admin
* needs_tests: => 1
* needs_docs: => 1
* type: Uncategorized => New feature
* stage: Unreviewed => Accepted


Comment:

I'm accepting, but marking as 'needs tests', because although it is a
simple change, we need tests that check that
`ModelAdmin.get_deleted_objects()` is actually used. This has been our
policy with other simple changes, like #14206 for
`ModelAdmin.get_list_display`, and `ListView.get_paginator`.

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

Django

unread,
Mar 30, 2017, 4:09:19 AM3/30/17
to django-...@googlegroups.com
#17962: Django Admin delete_view could benefit from extension points
-------------------------------+---------------------------------------
Reporter: Chris Wilson | Owner: Becky Smith
Type: New feature | Status: assigned

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

* owner: nobody => Becky Smith
* status: new => assigned


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

Django

unread,
Mar 30, 2017, 5:48:43 AM3/30/17
to django-...@googlegroups.com
#17962: Django Admin delete_view could benefit from extension points
-------------------------------+---------------------------------------
Reporter: Chris Wilson | Owner: Becky Smith
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------------------------
Changes (by Becky Smith):

* needs_docs: 1 => 0
* needs_tests: 1 => 0


Comment:

I have added PR [https://github.com/django/django/pull/8267 #8267] to
update the previously submitted patch and use the new ModelAdmin method in
the default `delete_selected` action as well as `delete_view`.

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

Django

unread,
Jun 13, 2017, 1:52:03 PM6/13/17
to django-...@googlegroups.com
#17962: Add ModelAdmin.get_deleted_objects() hook

-------------------------------+---------------------------------------
Reporter: Chris Wilson | Owner: Becky Smith
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------------------------

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

Django

unread,
Jun 13, 2017, 5:26:14 PM6/13/17
to django-...@googlegroups.com
#17962: Add ModelAdmin.get_deleted_objects() hook
-------------------------------+---------------------------------------
Reporter: Chris Wilson | Owner: Becky Smith
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+---------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


Comment:

I left comments for improvement on the PR. Please uncheck "Patch needs
improvement" after updating.

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

Django

unread,
Aug 24, 2017, 7:22:02 AM8/24/17
to django-...@googlegroups.com
#17962: Add ModelAdmin.get_deleted_objects() hook
-------------------------------+-----------------------------------------
Reporter: Chris Wilson | Owner: Rebecca Smith

Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------+-----------------------------------------
Changes (by Rebecca Smith):

* cc: Rebecca Smith (added)
* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/17962#comment:6>

Django

unread,
Feb 8, 2018, 10:38:13 AM2/8/18
to django-...@googlegroups.com
#17962: Add ModelAdmin.get_deleted_objects() hook
-------------------------------------+-------------------------------------

Reporter: Chris Wilson | Owner: Rebecca
| Smith
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/17962#comment:7>

Django

unread,
Feb 9, 2018, 12:44:33 PM2/9/18
to django-...@googlegroups.com
#17962: Add ModelAdmin.get_deleted_objects() hook
-------------------------------+-----------------------------------------
Reporter: Chris Wilson | Owner: Rebecca Smith
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------+-----------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1

* stage: Ready for checkin => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/17962#comment:8>

Django

unread,
Feb 19, 2018, 9:35:55 AM2/19/18
to django-...@googlegroups.com
#17962: Add ModelAdmin.get_deleted_objects() hook
-------------------------------------+-------------------------------------
Reporter: Chris Wilson | Owner: Rebecca
| Smith
Type: New feature | Status: assigned
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* needs_better_patch: 1 => 0


* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/17962#comment:9>

Django

unread,
Feb 24, 2018, 9:01:03 PM2/24/18
to django-...@googlegroups.com
#17962: Add ModelAdmin.get_deleted_objects() hook
-------------------------------------+-------------------------------------
Reporter: Chris Wilson | Owner: Rebecca
| Smith
Type: New feature | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: fixed

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

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


Comment:

In [changeset:"8116e588dbdd17171a322da589b691bdf01f7041" 8116e588]:
{{{
#!CommitTicketReference repository=""
revision="8116e588dbdd17171a322da589b691bdf01f7041"
Fixed #17962 -- Added ModelAdmin.get_deleted_objects().
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/17962#comment:10>

Reply all
Reply to author
Forward
0 new messages