From d01709aae21de9cd2565b9c52f32732ea28a2d98 Mon Sep 17 00:00:00 2001 From: Johan Schiff Date: Tue, 9 Jun 2020 11:23:31 +0200 Subject: Fixed #24141 -- Added QuerySet.contains(). --- docs/topics/db/optimization.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'docs/topics') diff --git a/docs/topics/db/optimization.txt b/docs/topics/db/optimization.txt index 69eb58212a..180cd60a46 100644 --- a/docs/topics/db/optimization.txt +++ b/docs/topics/db/optimization.txt @@ -240,6 +240,12 @@ row in the results, even if it ends up only using a few columns. The lot of text data or for fields that might take a lot of processing to convert back to Python. As always, profile first, then optimize. +Use ``QuerySet.contains(obj)`` +------------------------------ + +...if you only want to find out if ``obj`` is in the queryset, rather than +``if obj in queryset``. + Use ``QuerySet.count()`` ------------------------ -- cgit v1.3