mirror of
https://github.com/django/django.git
synced 2025-11-25 13:13:28 +00:00
Fixed #31783 -- Fixed crash when filtering againts "negate" field.
Thanks Simon Charette for the initial patch.
This commit is contained in:
parent
b6dfdaff33
commit
9c9a3fe118
3 changed files with 16 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue