Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #11116 -- Corrected the deletion of proxy objects. Thanks to Sa…

…muel Adam for the fix.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10824 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 2e24596001bce6e827e31510241834ccff76979f 1 parent b9b9ca3
Russell Keith-Magee authored May 19, 2009
2  django/db/models/base.py
@@ -538,7 +538,7 @@ def _collect_sub_objects(self, seen_objs, parent=None, nullable=False):
538 538
         # traversing to the most remote parent classes -- those with no parents
539 539
         # themselves -- and then adding those instances to the collection. That
540 540
         # will include all the child instances down to "self".
541  
-        parent_stack = self._meta.parents.values()
  541
+        parent_stack = [p for p in self._meta.parents.values() if p is not None]
542 542
         while parent_stack:
543 543
             link = parent_stack.pop()
544 544
             parent_obj = getattr(self, link.name)
9  tests/modeltests/proxy_models/models.py
@@ -276,6 +276,15 @@ class Meta:
276 276
 >>> UserProxyProxy.objects.all()
277 277
 [<UserProxyProxy: Bruce>]
278 278
 
  279
+# Proxy objects can be deleted
  280
+>>> u2 = UserProxy.objects.create(name='George')
  281
+>>> UserProxy.objects.all()
  282
+[<UserProxy: Bruce>, <UserProxy: George>]
  283
+>>> u2.delete()
  284
+>>> UserProxy.objects.all()
  285
+[<UserProxy: Bruce>]
  286
+
  287
+
279 288
 # We can still use `select_related()` to include related models in our querysets.
280 289
 >>> country = Country.objects.create(name='Australia')
281 290
 >>> state = State.objects.create(name='New South Wales', country=country)

0 notes on commit 2e24596

Please sign in to comment.
Something went wrong with that request. Please try again.