summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2025-09-16 10:57:32 -0400
committerJacob Walls <jacobtylerwalls@gmail.com>2025-09-16 12:54:10 -0400
commite059bbec96ed85d5f4d63893d687c8af966430c8 (patch)
tree0fbd94011560afe8b1fe47c92a34fe6977b00d78 /django/db
parent8c621e96422e037c3997c8c9515bc050620852f6 (diff)
Refs #27222 -- Deduplicated db_returning fields in Model.save().
Follow-up to 94680437a45a71c70ca8bd2e68b72aa1e2eff337.
Diffstat (limited to 'django/db')
-rw-r--r--django/db/models/base.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 358a744675..82ea520065 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -1153,7 +1153,8 @@ class Model(AltersData, metaclass=ModelBase):
getattr(self, field.attname) if raw else field.pre_save(self, False)
)
if hasattr(value, "resolve_expression"):
- returning_fields.append(field)
+ if field not in returning_fields:
+ returning_fields.append(field)
elif field.db_returning:
returning_fields.remove(field)
results = self._do_insert(