summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorClifford Gama <cliffygamy@gmail.com>2025-05-26 16:44:08 +0200
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-06-06 17:41:51 +0200
commit6fc620b4a8e91839b93af2b52d80bdbd5f8a1fcc (patch)
tree1d6c28c7912e95993912992381c2e4b50a489928 /django
parent8fcc83953c350e158a484bf1da0aa1b79b69bb07 (diff)
[5.2.x] Fixed #36419 -- Ensured for_save was propagated when resolving expressions.
The for_save flag wasn't properly propagated when resolving expressions, which prevented get_db_prep_save() from being called in some cases. This affected fields like JSONField where None would be saved as JSON null instead of SQL NULL. Regression in 00c690efbc0b10f67924687f24a7b30397bf47d9. Thanks to David Sanders and Simon Charette for reviews. Co-authored-by: Adam Johnson <me@adamj.eu> Backport of c1fa3fdd040718356e5a3b9a0fe699d73f47a940 from main.
Diffstat (limited to 'django')
-rw-r--r--django/db/models/expressions.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py
index 444e2fab7b..49a29392da 100644
--- a/django/db/models/expressions.py
+++ b/django/db/models/expressions.py
@@ -297,7 +297,7 @@ class BaseExpression:
c.is_summary = summarize
source_expressions = [
(
- expr.resolve_expression(query, allow_joins, reuse, summarize)
+ expr.resolve_expression(query, allow_joins, reuse, summarize, for_save)
if expr is not None
else None
)