#33534: Formset form with initial values doesnt save
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
saschahofmann |
Type: Bug | Status: new
Component: Forms | Version: 4.0
Severity: Normal | Keywords: formset initial
Triage Stage: | save
Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
Calling `formset.save()` on a formset with an extra_form that only hasn't
changed any of the initial values doesn't save.
I believe the cause is in
[https://github.com/django/django/blob/main/django/forms/models.py#L942].
`form.has_changed()` checks whether data is different compared to initial
values. This behaviour is incosistent with `form.save()` e.g. you could
call something like `formset.extra_forms[0].save()` and this would save
the form.
It seems reasonable to me to simple remove that line! Why would a new item
not be saved on Submit?
Happy to submit the according PR.
--
Ticket URL: <https://code.djangoproject.com/ticket/33534>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/056.1f5976f96d5d3a51f10b4f238e9bab8b%40djangoproject.com.