From b79702b2deec4ca3c625e5bffe46fa976c3c4e5f Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Sat, 24 Oct 2009 00:28:39 +0000 Subject: 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 --- docs/ref/models/querysets.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'docs') diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index efd7c549b8..e685472cca 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -1114,6 +1114,17 @@ 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 ------------- -- cgit v1.3