{{{
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.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> 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.
New description:
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 field content is skipped and
not saved to the form instance.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27220#comment:1>
Old description:
> 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 field content is skipped and
> not saved to the form instance.
New description:
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 field content is skipped and
not saved to the model instance.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27220#comment:2>
Old description:
> 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 field content is skipped and
> not saved to the model instance.
New description:
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 = TestWidget(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 field content is skipped and
not saved to the model instance.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27220#comment:3>
Old description:
> 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 = TestWidget(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 field content is skipped and
> not saved to the model instance.
New description:
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 = TestWidget()
}}}
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 field content is skipped and
not saved to the model instance.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/27220#comment:4>
* version: 1.10 => master
--
Ticket URL: <https://code.djangoproject.com/ticket/27220#comment:5>
Comment (by andreage):
See also https://code.djangoproject.com/ticket/27186
--
Ticket URL: <https://code.djangoproject.com/ticket/27220#comment:6>
* status: new => closed
* resolution: => duplicate
Comment:
Duplicate of #27186. Please check the patch there.
--
Ticket URL: <https://code.djangoproject.com/ticket/27220#comment:7>