diff --git a/django/db/models/query.py b/django/db/models/query.py
index 6774fee..37ae072 100644
a
|
b
|
class QuerySet(object):
|
577 | 577 | if self._result_cache is None: |
578 | 578 | return self.query.has_results(using=self.db) |
579 | 579 | return bool(self._result_cache) |
| 580 | |
| 581 | def contains(self, obj): |
| 582 | if self._result_cache is not None: |
| 583 | return obj in self._result_cache |
| 584 | return isinstance(obj, self.model) and self.filter(pk=obj.pk).exists() |
580 | 585 | |
581 | 586 | def _prefetch_related_objects(self): |
582 | 587 | # This method can only be called once the result cache has been filled. |