mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #7778 -- Fixed a tricky case of foreign key clearing with inherited
models. Patch from James Murty. git-svn-id: http://code.djangoproject.com/svn/django/trunk@8100 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ccab4b041b
commit
3cbe73692e
3 changed files with 32 additions and 1 deletions
|
@ -836,7 +836,9 @@ def delete_objects(seen_objs):
|
|||
|
||||
update_query = sql.UpdateQuery(cls, connection)
|
||||
for field in cls._meta.fields:
|
||||
if field.rel and field.null and field.rel.to in seen_objs:
|
||||
if (field.rel and field.null and field.rel.to in seen_objs and
|
||||
filter(lambda f: f.column == field.column,
|
||||
field.rel.to._meta.fields)):
|
||||
update_query.clear_related(field, pk_list)
|
||||
|
||||
# Now delete the actual data.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue