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

Fixed #16211 -- Added logical NOT support to F expressions.

This commit is contained in:
David Wobrock
2022-09-26 22:59:25 +02:00
committed by Mariusz Felisiak
parent c01e76c95c
commit a320aab512
7 changed files with 164 additions and 29 deletions

View File

@@ -8,7 +8,7 @@ from django.db.models import (
Q,
Value,
)
from django.db.models.expressions import RawSQL
from django.db.models.expressions import NegatedExpression, RawSQL
from django.db.models.functions import Lower
from django.db.models.sql.where import NothingNode
from django.test import SimpleTestCase, TestCase
@@ -87,7 +87,7 @@ class QTests(SimpleTestCase):
]
for q in tests:
with self.subTest(q=q):
self.assertIs(q.negated, True)
self.assertIsInstance(q, NegatedExpression)
def test_deconstruct(self):
q = Q(price__gt=F("discounted_price"))