Revert 'empty' usage to it's previous state

This commit is contained in:
Filip Kucharczyk 2019-12-06 10:14:22 +01:00
parent 6e8196d475
commit 1b38309d70
2 changed files with 4 additions and 4 deletions

View File

@ -686,7 +686,7 @@ class BaseQuerySet(object):
.. versionchanged:: 0.6 Raises InvalidQueryError if filter has been set
"""
queryset = self.clone()
if queryset._query_obj:
if not queryset._query_obj.empty:
msg = "Cannot use a filter whilst using `with_id`"
raise InvalidQueryError(msg)
return queryset.filter(pk=object_id).first()

View File

@ -102,14 +102,14 @@ class QNode(object):
return self
# Or if this Q is empty, ignore it and just use `other`.
if not self:
if self.empty:
return other
return QCombination(operation, [self, other])
@property
def empty(self):
msg = "'empty' property is deprecated in favour of using 'not bool(filter)"
msg = "'empty' property is deprecated in favour of using 'not bool(filter)'"
warnings.warn(msg, DeprecationWarning)
return False
@ -154,7 +154,7 @@ class QCombination(QNode):
@property
def empty(self):
msg = "'empty' property is deprecated in favour of using 'not bool(filter)"
msg = "'empty' property is deprecated in favour of using 'not bool(filter)'"
warnings.warn(msg, DeprecationWarning)
return not bool(self.children)