1
0
mirror of https://github.com/django/django.git synced 2025-10-25 14:46:09 +00:00

[2.1.x] Fixed #29727 -- Made nonexistent joins in F() raise FieldError.

Regression in 2162f0983d.

Backport of f315d0423a from master
This commit is contained in:
Alexander Holmbäck
2018-09-06 20:10:20 +00:00
committed by Tim Graham
parent ed60ce55c2
commit bd5ce0599b
3 changed files with 10 additions and 2 deletions

View File

@@ -595,6 +595,10 @@ class BasicExpressionsTests(TestCase):
with self.assertRaisesMessage(FieldError, "Cannot resolve keyword 'nope' into field."):
list(Employee.objects.filter(firstname=F('nope')))
def test_incorrect_joined_field_in_F_expression(self):
with self.assertRaisesMessage(FieldError, "Cannot resolve keyword 'nope' into field."):
list(Company.objects.filter(ceo__pk=F('point_of_contact__nope')))
class IterableLookupInnerExpressionsTests(TestCase):
@classmethod