summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorLightDiscord <root@arnaud.sh>2022-10-04 20:11:28 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-11-04 11:08:58 +0100
commite20c9eb60ab9d1c84b19672def918097c943edd8 (patch)
treeca449f88bc092614667a0bb30469799064397c9b /django/forms
parent5a7f3213ae4a2dc5e962ae1fcdedc6e6ab68dfcd (diff)
Fixed #27654 -- Propagated alters_data attribute to callables overridden in subclasses.
Thanks Shai Berger and Adam Johnson for reviews and the implementation idea.
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/models.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index b79157ce68..35ecdc1c0d 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -10,6 +10,7 @@ from django.core.exceptions import (
ImproperlyConfigured,
ValidationError,
)
+from django.db.models.utils import AltersData
from django.forms.fields import ChoiceField, Field
from django.forms.forms import BaseForm, DeclarativeFieldsMetaclass
from django.forms.formsets import BaseFormSet, formset_factory
@@ -329,7 +330,7 @@ class ModelFormMetaclass(DeclarativeFieldsMetaclass):
return new_class
-class BaseModelForm(BaseForm):
+class BaseModelForm(BaseForm, AltersData):
def __init__(
self,
data=None,
@@ -644,7 +645,7 @@ def modelform_factory(
# ModelFormSets ##############################################################
-class BaseModelFormSet(BaseFormSet):
+class BaseModelFormSet(BaseFormSet, AltersData):
"""
A ``FormSet`` for editing a queryset and/or adding new objects to it.
"""