#27220: MultiWidget not considered in form submit
----------------------------+--------------------
Reporter: andreage | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+--------------------
I have a custom widget for a field, for example:
{{{
class TestWidget(MultiWidget):
def __init__(self, attrs=None):
widgets = (
Select(choices=func_start()),
Select(choices=func_end())
)
super(TestWidget, self).__init__(widgets, attrs)
...
class TestModel(models.Model)
test = ArrayField(models.PositiveSmallIntegerField(), default=list,
blank=True)
class TestForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(TestForm, self).__init__(*args, **kwargs)
self.fields['test'].widget = SlotsWidget(self.facility)
}}}
It's been working fine until Django 10.0. With Django 10.1 and
specifically due to this commit it breaks.
https://github.com/django/django/commit/4bc6b939944183533ae74791d21282e613f63a96
#diff-70af885c2725fe87eb3b99a393268d10
`f.name` in this commit would be "test", but `form.data` would contain
"test_0" and "test_1". For this reason form content is skipped and not
saved to the form instance.
--
Ticket URL: <https://code.djangoproject.com/ticket/27220>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.93ff523b5883a8ecb11794200f52ca2f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.