summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/test_array.py
diff options
context:
space:
mode:
authorChason Chaffin <chason@gmail.com>2019-07-03 18:32:43 +0900
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-07-03 13:35:51 +0200
commitc238e65e29494042d6ccf925c0a06a3135619799 (patch)
treea729fe3b0446a2c8ba29bf555fe3656cccce574d /tests/postgres_tests/test_array.py
parent54dcfbc36780054d39299bfd1078938e5dd4e839 (diff)
downloaddjango-c238e65e29494042d6ccf925c0a06a3135619799.tar.gz
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.
Diffstat (limited to 'tests/postgres_tests/test_array.py')
-rw-r--r--tests/postgres_tests/test_array.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index d7ed5223e3..170c1caa0a 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -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):