Opened 10 years ago

Closed 10 years ago

Last modified 7 years ago

#7483 closed (fixed)

[newforms-admin] Delete view doesn't link to related objects

Reported by: Daniel Roseman <daniel@…> Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by Ramiro Morales)

The get_deleted_objects function in django.contrib.admin.util lists the related objects that will be affected by a delete operation. It contains code to link each item to its actual admin page. However, this is never called because in order to check if the model has an admin page, it checks has_admin = related.__class__ in admin_site._registry - but related.__class__ is always <class 'django.db.models.related.RelatedObject'>, which naturally does not match anything in _registry. This needs to be changed to related.model, which does work.

Patch includes this change, plus big changes to the admin_views regression test and fixture to set up a related model to test this against.

Attachments (1)

delete_related.diff (5.6 KB) - added by Daniel Roseman <daniel@…> 10 years ago.
Patch and updated tests/fixtures

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by Daniel Roseman <daniel@…>

Attachment: delete_related.diff added

Patch and updated tests/fixtures

comment:1 Changed 10 years ago by Ramiro Morales

Description: modified (diff)

comment:2 Changed 10 years ago by simon

Resolution: fixed
Status: newclosed

(In [7685]) newforms-admin: Fixed #7483 (thanks, Daniel Roseman) - delete view now correctly links to related objects

comment:3 Changed 7 years ago by Jacob

milestone: 1.0 alpha

Milestone 1.0 alpha deleted

Note: See TracTickets for help on using tickets.
Back to Top