summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/forms/models.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/django/forms/models.py b/django/forms/models.py
index af324c2b27..ed9df60321 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -894,12 +894,17 @@ class BaseInlineFormSet(BaseModelFormSet):
def _construct_form(self, i, **kwargs):
form = super(BaseInlineFormSet, self)._construct_form(i, **kwargs)
if self.save_as_new:
+ mutable = getattr(form.data, '_mutable', None)
+ # Allow modifying an immutable QueryDict.
+ if mutable is not None:
+ form.data._mutable = True
# Remove the primary key from the form's data, we are only
# creating new instances
form.data[form.add_prefix(self._pk_field.name)] = None
-
# Remove the foreign key from the form's data
form.data[form.add_prefix(self.fk.name)] = None
+ if mutable is not None:
+ form.data._mutable = mutable
# Set the fk value here so that the form can do its validation.
fk_value = self.instance.pk