mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-04-20 11:10:59 +00:00
patch to issue#16
This commit is contained in:
parent
ea4f98d91f
commit
6ab6da083c
1 changed files with 6 additions and 1 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue