Commits

jgsogo committed 48e76bd

patch to issue#16

Comments (0)

Files changed (1)

model_utils/managers.py

         iter = super(InheritanceQuerySet, self).iterator()
         if getattr(self, 'subclasses', False):
             for obj in iter:
-                sub_obj = [getattr(obj, s) for s in self.subclasses if getattr(obj, s)] or [obj]
+                def get_attr(obj, s):
+                    try:
+                        return getattr(obj,s)
+                    except:
+                        return None
+                sub_obj = [getattr(obj, s) for s in self.subclasses if get_attr(obj, s)] or [obj]
                 sub_obj = sub_obj[0]
                 if getattr(self, '_annotated', False):
                     for k in self._annotated: