1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #21703 -- Fixed a crash when excluding a related field with a F().

This commit is contained in:
Simon Charette
2019-03-08 02:06:34 -05:00
committed by Tim Graham
parent cbf7e71558
commit f19a4945e1
2 changed files with 12 additions and 1 deletions

View File

@@ -2776,6 +2776,12 @@ class ExcludeTests(TestCase):
employment__title__in=('Engineer', 'Developer')).distinct().order_by('name')
self.assertSequenceEqual(alex_nontech_employers, [google, intel, microsoft])
def test_exclude_reverse_fk_field_ref(self):
tag = Tag.objects.create()
Note.objects.create(tag=tag, note='note')
annotation = Annotation.objects.create(name='annotation', tag=tag)
self.assertEqual(Annotation.objects.exclude(tag__note__note=F('name')).get(), annotation)
class ExcludeTest17600(TestCase):
"""