From b219af89ea28c4748ade02e8ffb925e61475bbc7 Mon Sep 17 00:00:00 2001 From: Barry Daniels Date: Thu, 20 Feb 2025 18:09:12 +0100 Subject: [PATCH] update not operator sql query --- src/dso_api/dynamic_api/filters/lookups.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dso_api/dynamic_api/filters/lookups.py b/src/dso_api/dynamic_api/filters/lookups.py index ecb8af505..2ab2bc24f 100644 --- a/src/dso_api/dynamic_api/filters/lookups.py +++ b/src/dso_api/dynamic_api/filters/lookups.py @@ -51,7 +51,7 @@ def as_sql(self, compiler, connection): # Allow field__not=value to return NULL fields too. if field_type in ["CharField", "TextField"] and not self.lhs.field.primary_key: return ( - f"{lhs} IS NULL OR UPPER({lhs}) != UPPER({rhs})", + f"({lhs} IS NULL OR UPPER({lhs}) != UPPER({rhs}))", list(lhs_params + lhs_params) + [rhs.upper() if isinstance(rhs, str) else rhs for rhs in rhs_params], )