mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #28047 -- Fixed QuerySet.filter() crash when it uses the name of a OneToOneField pk.
Regression in 1bc249c2a6.
This commit is contained in:
@@ -83,7 +83,8 @@ class RelatedIn(In):
|
||||
else:
|
||||
if getattr(self.rhs, '_forced_pk', False):
|
||||
self.rhs.clear_select_clause()
|
||||
if getattr(self.lhs.output_field, 'primary_key', False):
|
||||
if (getattr(self.lhs.output_field, 'primary_key', False) and
|
||||
self.lhs.output_field.model == self.rhs.model):
|
||||
# A case like Restaurant.objects.filter(place__in=restaurant_qs),
|
||||
# where place is a OneToOneField and the primary key of
|
||||
# Restaurant.
|
||||
|
||||
Reference in New Issue
Block a user