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
|
.. versionchanged:: 0.6 Raises InvalidQueryError if filter has been set
|
||||||
"""
|
"""
|
||||||
queryset = self.clone()
|
queryset = self.clone()
|
||||||
if queryset._query_obj:
|
if not queryset._query_obj.empty:
|
||||||
msg = "Cannot use a filter whilst using `with_id`"
|
msg = "Cannot use a filter whilst using `with_id`"
|
||||||
raise InvalidQueryError(msg)
|
raise InvalidQueryError(msg)
|
||||||
return queryset.filter(pk=object_id).first()
|
return queryset.filter(pk=object_id).first()
|
||||||
|
@ -102,14 +102,14 @@ class QNode(object):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
# Or if this Q is empty, ignore it and just use `other`.
|
# Or if this Q is empty, ignore it and just use `other`.
|
||||||
if not self:
|
if self.empty:
|
||||||
return other
|
return other
|
||||||
|
|
||||||
return QCombination(operation, [self, other])
|
return QCombination(operation, [self, other])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def empty(self):
|
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)
|
warnings.warn(msg, DeprecationWarning)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ class QCombination(QNode):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def empty(self):
|
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)
|
warnings.warn(msg, DeprecationWarning)
|
||||||
return not bool(self.children)
|
return not bool(self.children)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user