1
0
mirror of https://github.com/django/django.git synced 2025-10-27 15:46:10 +00:00

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 00c690efbc.

Thanks to David Sanders and Simon Charette for reviews.

Co-authored-by: Adam Johnson <me@adamj.eu>
This commit is contained in:
Clifford Gama
2025-05-26 16:44:08 +02:00
committed by Sarah Boyce
parent 9579517552
commit c1fa3fdd04
3 changed files with 21 additions and 2 deletions

View File

@@ -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
)