diff --git a/django/contrib/admin/util.py b/django/contrib/admin/util.py
index 7204a12..f69ad4a 100644
a
|
b
|
class NestedObjects(Collector):
|
133 | 133 | return qs.select_related(related.field.name) |
134 | 134 | |
135 | 135 | def _nested(self, obj, seen, format_callback): |
136 | | if obj in seen: |
| 136 | if (obj.__class__, obj) in seen: |
137 | 137 | return [] |
138 | | seen.add(obj) |
| 138 | seen.add((obj.__class__, obj)) |
139 | 139 | children = [] |
140 | 140 | for child in self.edges.get(obj, ()): |
141 | 141 | children.extend(self._nested(child, seen, format_callback)) |