Revert 'empty' usage to it's previous state
This commit is contained in:
parent
6e8196d475
commit
1b38309d70
@ -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()
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user