patch to issue#16

This commit is contained in:
Javier Garcia Sogo 2012-07-06 22:12:58 +02:00
parent ea4f98d91f
commit 6ab6da083c

View file

@ -33,7 +33,12 @@ class InheritanceQuerySet(QuerySet):
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: