django-sql-utils icon indicating copy to clipboard operation
django-sql-utils copied to clipboard

SubqueryCount is incompatible with PolymorphicQuerySet

Open nbrede opened this issue 6 years ago • 0 comments

When used to annotate a PolymorphicQuerySet from django-polymorphic, this error is raised:

'NoneType' object has no attribute 'query'

in

django/db/models/expressions.py in get_source_expressions at line 1051
    def get_source_expressions(self):
        return [
            x for x in [
                getattr(expr, 'lhs', None)
                for expr in self.queryset.query.where.children
            ] if x
        ]
    def relabeled_clone(self, change_map):
        clone = self.copy()

nbrede avatar Dec 02 '19 14:12 nbrede