mirror of
https://github.com/django/django.git
synced 2025-10-26 23:26:08 +00:00
Fixed #15776 - delete regression in Django 1.3 involving nullable foreign keys
Many thanks to aaron.l.madison for the detailed report and to emulbreh for the fix. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16295 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -82,8 +82,8 @@ class Collector(object):
|
||||
def add(self, objs, source=None, nullable=False, reverse_dependency=False):
|
||||
"""
|
||||
Adds 'objs' to the collection of objects to be deleted. If the call is
|
||||
the result of a cascade, 'source' should be the model that caused it
|
||||
and 'nullable' should be set to True, if the relation can be null.
|
||||
the result of a cascade, 'source' should be the model that caused it,
|
||||
and 'nullable' should be set to True if the relation can be null.
|
||||
|
||||
Returns a list of all objects that were not already collected.
|
||||
"""
|
||||
@@ -99,7 +99,7 @@ class Collector(object):
|
||||
# Nullable relationships can be ignored -- they are nulled out before
|
||||
# deleting, and therefore do not affect the order in which objects have
|
||||
# to be deleted.
|
||||
if new_objs and source is not None and not nullable:
|
||||
if source is not None and not nullable:
|
||||
if reverse_dependency:
|
||||
source, model = model, source
|
||||
self.dependencies.setdefault(source, set()).add(model)
|
||||
|
||||
Reference in New Issue
Block a user