Объект Django 'QuerySet' не имеет атрибута '_deferred_filter'

Только что обновился с Django 2.2 до 3.2 и столкнулся с этой ошибкой:

'QuerySet' object has no attribute '_deferred_filter'

Из трассировки стека:

  File "/Users/jlin/projects/mp2/ext_db/models.py", line 434, in get_queryset
    return super(SOActiveManager, self).get_queryset().exclude(

  File "/Users/jlin/virtualenvs/mp2/lib/python3.8/site-packages/django/db/models/query.py", line 949, in exclude
    return self._filter_or_exclude(True, args, kwargs)

  File "/Users/jlin/virtualenvs/mp2/lib/python3.8/site-packages/django/db/models/query.py", line 961, in _filter_or_exclude
    clone._filter_or_exclude_inplace(negate, args, kwargs)

  File "/Users/jlin/virtualenvs/mp2/lib/python3.8/site-packages/django/db/models/query.py", line 966, in _filter_or_exclude_inplace
    self._query.add_q(~Q(*args, **kwargs))

  File "/Users/jlin/virtualenvs/mp2/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1393, in add_q
    clause, _ = self._add_q(q_object, self.used_aliases)

  File "/Users/jlin/virtualenvs/mp2/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1412, in _add_q
    child_clause, needed_inner = self.build_filter(

  File "/Users/jlin/virtualenvs/mp2/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1295, in build_filter
    value = self.resolve_lookup_value(value, can_reuse, allow_joins)

  File "/Users/jlin/virtualenvs/mp2/lib/python3.8/site-packages/django/db/models/sql/query.py", line 1087, in resolve_lookup_value
    value = value.resolve_expression(

  File "/Users/jlin/virtualenvs/mp2/lib/python3.8/site-packages/django/db/models/query.py", line 1365, in resolve_expression
    query = self.query.resolve_expression(*args, **kwargs)

  File "/Users/jlin/virtualenvs/mp2/lib/python3.8/site-packages/django/db/models/query.py", line 196, in query
    if self._deferred_filter:

AttributeError: 'QuerySet' object has no attribute '_deferred_filter'

А это код, который вызвал ошибку

class SOActiveManager(models.Manager):
    def get_queryset(self):
        return super(SOActiveManager, self).get_queryset().exclude(
            status__in=SOStatuses.closed_statuses()
        )

вызван

sos = ServiceOrders.active.filter(account__number=customer_id).count()
Вернуться на верх