mirror of
https://github.com/django/django.git
synced 2025-12-23 09:19:27 +00:00
Fixed #36787 -- Fixed crash in In lookups with mixed expressions and strings.
Signed-off-by: JaeHyuck Sa <wogur981208@gmail.com>
This commit is contained in:
parent
95394443bf
commit
163d92c1d6
2 changed files with 9 additions and 1 deletions
|
|
@ -295,7 +295,7 @@ class FieldGetDbPrepValueIterableMixin(FieldGetDbPrepValueMixin):
|
|||
(
|
||||
value
|
||||
if hasattr(value, "resolve_expression")
|
||||
else Value(value, self.lhs.output_field)
|
||||
else Value(value, getattr(self.lhs, "output_field", None))
|
||||
)
|
||||
for value in self.rhs
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1855,6 +1855,14 @@ class LookupQueryingTests(TestCase):
|
|||
Season.objects.filter(In(F("year"), years)).order_by("pk"), seasons
|
||||
)
|
||||
|
||||
def test_in_lookup_in_filter_text_field(self):
|
||||
self.assertSequenceEqual(
|
||||
Season.objects.filter(
|
||||
In(F("nulled_text_field"), [F("nulled_text_field"), "special_value"])
|
||||
),
|
||||
[self.s2],
|
||||
)
|
||||
|
||||
def test_filter_lookup_lhs(self):
|
||||
qs = Season.objects.annotate(before_20=LessThan(F("year"), 2000)).filter(
|
||||
before_20=LessThan(F("year"), 1900),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue