mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
Fixed #16128 - Correctly cascade-delete proxy models as if they were the concrete model class. Thanks xkennyx for the report, and Aymeric Augustin, Claude Paroz, Adam Nelson, jaap3, and Anssi Kääriäinen for work on the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17664 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -144,6 +144,7 @@ class Collector(object):
|
||||
reverse_dependency=reverse_dependency)
|
||||
if not new_objs:
|
||||
return
|
||||
|
||||
model = new_objs[0].__class__
|
||||
|
||||
# Recursively collect parent models, but not their related objects.
|
||||
@@ -157,7 +158,8 @@ class Collector(object):
|
||||
reverse_dependency=True)
|
||||
|
||||
if collect_related:
|
||||
for related in model._meta.get_all_related_objects(include_hidden=True):
|
||||
for related in model._meta.get_all_related_objects(
|
||||
include_hidden=True, include_proxy_eq=True):
|
||||
field = related.field
|
||||
if related.model._meta.auto_created:
|
||||
self.add_batch(related.model, field, new_objs)
|
||||
|
||||
Reference in New Issue
Block a user