summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/db/models/query.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 4fe185ed6e..b08f3acd14 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -95,6 +95,8 @@ class CollectedObjects(object):
while len(dealt_with) < len(models):
found = False
for model in models:
+ if model in dealt_with:
+ continue
children = self.children.setdefault(model, [])
if len([c for c in children if c not in dealt_with]) == 0:
dealt_with[model] = None