1
0
mirror of https://github.com/django/django.git synced 2025-10-25 14:46:09 +00:00

Fixed #28543 -- Prevented ManyToManyField.value_from_object() from being lazy.

Previously, it was a QuerySet which could reevaluate to a new value if the
model's data changes. This is inconsistent with other Field.value_from_object()
methods.

This allows reverting the fix in the admin for refs #27998.
This commit is contained in:
Tim Graham
2017-08-31 09:34:44 -04:00
committed by GitHub
parent ec6481246a
commit e5bd585c6e
6 changed files with 41 additions and 18 deletions

View File

@@ -1468,10 +1468,6 @@ class ModelAdmin(BaseModelAdmin):
new_object = form.instance
formsets, inline_instances = self._create_formsets(request, new_object, change=not add)
if all_valid(formsets) and form_validated:
if not add:
# Evalute querysets in form.initial so that changes to
# ManyToManyFields are reflected in this change's LogEntry.
form.has_changed()
self.save_model(request, new_object, form, not add)
self.save_related(request, form, formsets, not add)
change_message = self.construct_change_message(request, form, formsets, add)