1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +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:
Tim Graham
2017-04-10 09:47:26 -04:00
parent a19b373d89
commit fce7827101
3 changed files with 9 additions and 1 deletions

View File

@@ -479,6 +479,10 @@ class OneToOneTests(TestCase):
pk__in=Restaurant.objects.filter(place__id=r.place.pk)
)
self.assertSequenceEqual(q2, [r])
q3 = Restaurant.objects.filter(place__in=Place.objects.all())
self.assertSequenceEqual(q3, [r])
q4 = Restaurant.objects.filter(place__in=Place.objects.filter(id=r.pk))
self.assertSequenceEqual(q4, [r])
def test_rel_pk_exact(self):
r = Restaurant.objects.first()