mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #31783 -- Fixed crash when filtering againts "negate" field.
Thanks Simon Charette for the initial patch.
This commit is contained in:
committed by
Mariusz Felisiak
parent
b6dfdaff33
commit
9c9a3fe118
@@ -47,7 +47,7 @@ class Queries1Tests(TestCase):
|
||||
|
||||
cls.n1 = Note.objects.create(note='n1', misc='foo', id=1)
|
||||
cls.n2 = Note.objects.create(note='n2', misc='bar', id=2)
|
||||
cls.n3 = Note.objects.create(note='n3', misc='foo', id=3)
|
||||
cls.n3 = Note.objects.create(note='n3', misc='foo', id=3, negate=False)
|
||||
|
||||
ann1 = Annotation.objects.create(name='a1', tag=cls.t1)
|
||||
ann1.notes.add(cls.n1)
|
||||
@@ -1216,6 +1216,13 @@ class Queries1Tests(TestCase):
|
||||
[self.a3, self.a4],
|
||||
)
|
||||
|
||||
def test_negate_field(self):
|
||||
self.assertSequenceEqual(
|
||||
Note.objects.filter(negate=True),
|
||||
[self.n1, self.n2],
|
||||
)
|
||||
self.assertSequenceEqual(Note.objects.exclude(negate=True), [self.n3])
|
||||
|
||||
|
||||
class Queries2Tests(TestCase):
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user