Changes between Initial Version and Version 1 of Ticket #28159
- Timestamp:
- May 1, 2017, 8:25:42 PM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #28159
- Property Needs tests set
- Property Severity Normal → Release blocker
- Property Triage Stage Unreviewed → Accepted
- Property Summary Fix issues with InlineFormset.save_as_new in Django 1.11 → Using InlineFormset.save_as_new crashes in Django 1.11
-
Ticket #28159 – Description
initial v1 1 Django 1.11 now marks multipart POST data as immutable [(Release notes section)](https://docs.djangoproject.com/en/1.11/releases/1.11/#miscellaneous). This causes an issue with the private ``save_as_new`` feature in InlineFormsets: the set code in the conditional block [here](https://github.com/django/django/blob/master/django/forms/models.py#L886) now throws an AttributeErrorbecause the data it's attempting to change is marked as immutable.1 Django 1.11 marks multipart POST data as immutable: 4a246a02bdcbc13b15480c014f51cb0682af7c1e (#17235) . This causes an issue with the private `save_as_new` feature in InlineFormsets: the set code in the conditional block in [https://github.com/django/django/blob/05098fa4494e66e1d3750d7f4821f7b3114693b9/django/forms/models.py#L886 BaseInlineFormSet._construct_form()] now raises `AttributeError` because the data it's attempting to change is marked as immutable. 2 2 3 To restore previous behavior, this pull requestturns off the immutability flag on the form data while the save_as_new functionality runs and turns immutability back on when the mutation code is complete.3 To restore previous behavior, [https://github.com/django/django/pull/8448 this pull request] turns off the immutability flag on the form data while the save_as_new functionality runs and turns immutability back on when the mutation code is complete. 4 4 5 Note that the mutable flag isn't set if there is no data, hence the ``hasattr`` code. 6 7 PR: https://github.com/django/django/pull/8448 5 Note that the mutable flag isn't set if there is no data, hence the `hasattr` code.