mirror of
https://github.com/django/django.git
synced 2025-09-23 10:42:45 +00:00
Fixed #18963 -- Used a subclass-friendly pattern
for Python 2 object model compatibility methods.
This commit is contained in:
parent
973f539ab8
commit
fc10418fba
14 changed files with 61 additions and 50 deletions
|
@ -136,7 +136,9 @@ class QuerySet(object):
|
|||
except StopIteration:
|
||||
return False
|
||||
return True
|
||||
__nonzero__ = __bool__ # Python 2
|
||||
|
||||
def __nonzero__(self): # Python 2 compatibility
|
||||
return type(self).__bool__(self)
|
||||
|
||||
def __contains__(self, val):
|
||||
# The 'in' operator works without this method, due to __iter__. This
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue