Using first() from cloned queryset
This commit is contained in:
parent
39735594bd
commit
c87801f0a9
@ -159,11 +159,7 @@ class BaseQuerySet(object):
|
|||||||
|
|
||||||
queryset = self.clone()
|
queryset = self.clone()
|
||||||
queryset._ordering = []
|
queryset._ordering = []
|
||||||
try:
|
return False if queryset.first() is None else True
|
||||||
queryset[0]
|
|
||||||
return True
|
|
||||||
except IndexError:
|
|
||||||
return False
|
|
||||||
|
|
||||||
def __nonzero__(self):
|
def __nonzero__(self):
|
||||||
""" Same behaviour in Py2 """
|
""" Same behaviour in Py2 """
|
||||||
|
Loading…
x
Reference in New Issue
Block a user