Issue #16 resolved

Problem? working with django 1.5 (repo version)

created an issue

I happened to update my django to 1.5 version and I found a problem working with InheritanceManager and select_subclasses

== Where == An exception is raised in InheritanceQuerySet::iterator method at line 36: {{{


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] sub_obj = sub_obj[0] if getattr(self, '_annotated', False): for k in self._annotated: setattr(sub_obj, k, getattr(obj, k))

            yield sub_obj
        for obj in iter:
            yield obj


== What happens ==

When listing children it raises a "no exception supplied" exception,



File "/home/javi/program/django_src/django/template/" in render 145. len_values = len(values) File "/home/javi/program/django_src/django/db/models/" in len 86. self._result_cache = list(self.iterator()) File "/home/javi/-----/django-apps/django-model-utils/model_utils/" in iterator 36. sub_obj = [getattr(obj, s) for s in self.subclasses if getattr(obj, s)] or [obj] File "/home/javi/program/django_src/django/db/models/fields/" in get 271. raise self.related.model.DoesNotExist

Exception Type: DoesNotExist at / }}}

== Why (my opinion) ==

I think that this exception is caused by this changeset in django trunk: where the commiter modifies the behaviour of SingleRelatedObjectDescriptor::__get__ raising an exception where it was returned None.

== Solution ==

I'm not familiar with django neither with model-utils internals, so I would be able to suggest only an ugly patch (the one I'm applying right now to get rid of this), maybe someone come accross this issue and offers a better one.

... or maybe this is not an issue for model-utils but for django itself...

Comments (8)

  1. Log in to comment