Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#18491 closed Bug (fixed)

When deleting a proxy model, the admin does not show warning about cascade delete for object with foreign key on the proxied model

Reported by: bdauvergne@… Owned by: Grzegorz Szczepańczyk
Component: contrib.admin Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Suppose this

class A(Model):
   pass

class ProxyA(A):
   class Meta:
      proxy = True

class B(Model):
   a = ForeignKey(A)

If you expose ProxyA in the admin/ and try to delete an instance which has linked B objects, there will be no warning about the cascading delete.

Change History (11)

comment:1 by Aymeric Augustin, 12 years ago

Here's the history of bugs related to deletion of proxy models: #18083, #16128, #12208, #11116.

comment:2 by Anssi Kääriäinen, 12 years ago

Triage Stage: UnreviewedAccepted

I have verified this in HEAD.

comment:3 by Grzegorz Szczepańczyk, 11 years ago

Owner: changed from nobody to Grzegorz Szczepańczyk
Status: newassigned

comment:4 by Grzegorz Szczepańczyk, 11 years ago

Has patch: set

I have added pull request with fix: https://github.com/django/django/pull/774

comment:5 by chomik, 11 years ago

Triage Stage: AcceptedReady for checkin

PR 774 seems ok for me.

comment:6 by Grzegorz Szczepańczyk, 11 years ago

I have pushed recommended solution.

comment:7 by Honza Kral <honza.kral@…>, 11 years ago

Resolution: fixed
Status: assignedclosed

In 2b48fcc607010065c0f8107baf669dd41b164f3c:

Fixed #18491 -- deleting a proxy doesn't show warning about cascade deletes

comment:8 by Tim Graham, 11 years ago

Fixing this seems to have introduced another regression, see #20777. We may revert this fix if we can't come up with a solution for that.

comment:9 by Tim Graham <timograham@…>, 11 years ago

In c769c266017c9a527444f8f026c7a76b394d0412:

[1.6.x] Revert "Fixed #18491 -- deleting a proxy doesn't show warning about cascade deletes"

This reverts commit 2b48fcc607010065c0f8107baf669dd41b164f3c.

It introduced a regression (#20777) which we can't easily fix in 1.6.

comment:10 by Tim Graham, 11 years ago

Fix has been reverted in 1.6.x, but will remain in master and removed (but fixed via a new change) in https://github.com/django/django/pull/1478

comment:11 by Anssi Kääriäinen, 11 years ago

Fixed again in 3844089edc43ff29aab5bac82a0eecab23d8d14a - the fix isn't in 1.6.x, only master.

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