Opened 11 years ago
Last modified 11 years ago
#24541 closed Cleanup/optimization
save_new_objects in ModelFromsets do not handle intitial data — at Initial Version
| Reported by: | Johannes Maron | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| Severity: | Normal | Keywords: | modelformset |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
If you create a Formset and pass initial data for some forms, the forms are evaluated as has_changed False.
All in all that is true, but it has the the side effect that the forms in the formset don't get saved, tho they contain data.
The error is here:
https://github.com/django/django/blob/master/django/forms/models.py#L777-L778
It should not only be checked for has_changed but also for initial data.
Note:
See TracTickets
for help on using tickets.