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:
Malcolm Tredinnick 2008-07-27 04:18:52 +00:00
parent ccab4b041b
commit 3cbe73692e
3 changed files with 32 additions and 1 deletions

View file

@ -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.