| 23 | |
| 24 | Implementing `__contains__` resolves the issue |
| 25 | |
| 26 | {{{#!diff |
| 27 | diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py |
| 28 | index dcba973ff4..0e4d259fa3 100644 |
| 29 | --- a/django/db/models/expressions.py |
| 30 | +++ b/django/db/models/expressions.py |
| 31 | @@ -884,6 +884,9 @@ def __repr__(self): |
| 32 | def __getitem__(self, subscript): |
| 33 | return Sliced(self, subscript) |
| 34 | |
| 35 | + def __contains__(self, other): |
| 36 | + return False |
| 37 | + |
| 38 | def resolve_expression( |
| 39 | self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False |
| 40 | ): |
| 41 | }}} |