mirror of
https://github.com/django/django.git
synced 2025-08-02 18:13:02 +00:00
Fixed #30596 -- Fixed SplitArrayField.has_changed() for non-string base fields.
Thanks to Evgeniy Krysanov for the report and the idea to use to_python. Thanks to Mariusz Felisiak for the test case.
This commit is contained in:
parent
54dcfbc367
commit
c238e65e29
2 changed files with 16 additions and 0 deletions
|
@ -909,6 +909,18 @@ class TestSplitFormField(PostgreSQLSimpleTestCase):
|
|||
obj = form.save(commit=False)
|
||||
self.assertEqual(obj.field, [1, 2])
|
||||
|
||||
def test_splitarrayfield_has_changed(self):
|
||||
class Form(forms.ModelForm):
|
||||
field = SplitArrayField(forms.IntegerField(), required=False, size=2)
|
||||
|
||||
class Meta:
|
||||
model = IntegerArrayModel
|
||||
fields = ('field',)
|
||||
|
||||
obj = IntegerArrayModel(field=[1, 2])
|
||||
form = Form({'field_0': '1', 'field_1': '2'}, instance=obj)
|
||||
self.assertFalse(form.has_changed())
|
||||
|
||||
|
||||
class TestSplitFormWidget(PostgreSQLWidgetTestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue