diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-05-19 12:44:17 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-05-19 12:44:17 +0000 |
| commit | b9b9ca334e335a2678f0ae560a9182ca5ed1bfcf (patch) | |
| tree | d13d8c7c40ac3f36205af0fc7eed98d0e51e46d5 /django | |
| parent | ae95edf91df4eb47c25f262a77749538b37d357e (diff) | |
Fixed #9308 -- Corrected the updated of nullable foreign key fields when deleting objects. Thanks to Bob Thomas for the fix, and markshep for the improvements on the test case.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10822 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/query.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py index 2e02f3f497..6a8d7d5e64 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -615,7 +615,7 @@ class QuerySet(object): clone = self._clone() clone.query.add_immediate_loading(fields) return clone - + ################################### # PUBLIC INTROSPECTION ATTRIBUTES # ################################### @@ -632,7 +632,7 @@ class QuerySet(object): else: return False ordered = property(ordered) - + ################### # PRIVATE METHODS # ################### @@ -1007,7 +1007,7 @@ def delete_objects(seen_objs): update_query = sql.UpdateQuery(cls, connection) for field, model in cls._meta.get_fields_with_model(): if (field.rel and field.null and field.rel.to in seen_objs and - filter(lambda f: f.column == field.column, + filter(lambda f: f.column == field.rel.get_related_field().column, field.rel.to._meta.fields)): if model: sql.UpdateQuery(model, connection).clear_related(field, |
