mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Fixed #11402: added a QuerySet.exists()
method. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11646 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
9f70783b14
commit
b79702b2de
6 changed files with 31 additions and 28 deletions
|
@ -1114,6 +1114,17 @@ Aggregation <topics-db-aggregation>`.
|
|||
|
||||
.. _field-lookups:
|
||||
|
||||
``exists()``
|
||||
~~~~~~~~~~~~
|
||||
|
||||
.. versionadded:: 1.2
|
||||
|
||||
Returns ``True`` if the :class:`QuerySet` contains any results, and ``False``
|
||||
if not. This tries to perform the query in the simplest and fastest way
|
||||
possible, but it *does* execute nearly the same query. This means that calling
|
||||
:meth:`QuerySet.exists()` is faster that ``bool(some_query_set)``, but not by
|
||||
a large degree.
|
||||
|
||||
Field lookups
|
||||
-------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue