Loading django/db/models/query.py +1 −1 Original line number Diff line number Diff line Loading @@ -1132,7 +1132,7 @@ class QuerySet(object): # if they are set up to select only a single field. if len(self._fields or self.model._meta.concrete_fields) > 1: raise TypeError('Cannot use multi-field values as a filter value.') else: elif self.model != field.model: # If the query is used as a subquery for a ForeignKey with non-pk # target field, make sure to select the target field in the subquery. foreign_fields = getattr(field, 'foreign_related_fields', ()) Loading docs/releases/1.9.5.txt +4 −0 Original line number Diff line number Diff line Loading @@ -30,3 +30,7 @@ Bugfixes * Fixed a regression that caused ``collectstatic --clear`` to fail if the storage doesn't implement ``path()`` (:ticket:`26297`). * Fixed a crash when using a reverse lookup with a subquery when a ``ForeignKey`` has a ``to_field`` set to something other than the primary key (:ticket:`26373`). tests/queries/tests.py +4 −0 Original line number Diff line number Diff line Loading @@ -2427,6 +2427,10 @@ class ToFieldTests(TestCase): set(Eaten.objects.filter(food__in=Food.objects.filter(name='apple').values('eaten__meal'))), set() ) self.assertEqual( set(Food.objects.filter(eaten__in=Eaten.objects.filter(meal='lunch'))), {apple} ) def test_reverse_in(self): apple = Food.objects.create(name="apple") Loading Loading
django/db/models/query.py +1 −1 Original line number Diff line number Diff line Loading @@ -1132,7 +1132,7 @@ class QuerySet(object): # if they are set up to select only a single field. if len(self._fields or self.model._meta.concrete_fields) > 1: raise TypeError('Cannot use multi-field values as a filter value.') else: elif self.model != field.model: # If the query is used as a subquery for a ForeignKey with non-pk # target field, make sure to select the target field in the subquery. foreign_fields = getattr(field, 'foreign_related_fields', ()) Loading
docs/releases/1.9.5.txt +4 −0 Original line number Diff line number Diff line Loading @@ -30,3 +30,7 @@ Bugfixes * Fixed a regression that caused ``collectstatic --clear`` to fail if the storage doesn't implement ``path()`` (:ticket:`26297`). * Fixed a crash when using a reverse lookup with a subquery when a ``ForeignKey`` has a ``to_field`` set to something other than the primary key (:ticket:`26373`).
tests/queries/tests.py +4 −0 Original line number Diff line number Diff line Loading @@ -2427,6 +2427,10 @@ class ToFieldTests(TestCase): set(Eaten.objects.filter(food__in=Food.objects.filter(name='apple').values('eaten__meal'))), set() ) self.assertEqual( set(Food.objects.filter(eaten__in=Eaten.objects.filter(meal='lunch'))), {apple} ) def test_reverse_in(self): apple = Food.objects.create(name="apple") Loading