Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
patch to issue#16
  • Loading branch information
jgsogo committed Jul 6, 2012
1 parent ea4f98d commit 6ab6da0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion model_utils/managers.py
Expand Up @@ -33,7 +33,12 @@ def iterator(self):
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:
Expand Down

0 comments on commit 6ab6da0

Please sign in to comment.