mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
[py3] Replaced __nonzero__ by __bool__
Of course, __nonzero__ alias has been kept for Python 2 compatibility.
This commit is contained in:
parent
12cda89ffe
commit
576ec12f8e
7 changed files with 15 additions and 8 deletions
|
@ -230,7 +230,7 @@ It is optimal because:
|
|||
#. Use of :ttag:`with` means that we store ``user.emails.all`` in a variable
|
||||
for later use, allowing its cache to be re-used.
|
||||
|
||||
#. The line ``{% if emails %}`` causes ``QuerySet.__nonzero__()`` to be called,
|
||||
#. The line ``{% if emails %}`` causes ``QuerySet.__bool__()`` to be called,
|
||||
which causes the ``user.emails.all()`` query to be run on the database, and
|
||||
at the least the first line to be turned into an ORM object. If there aren't
|
||||
any results, it will return False, otherwise True.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue