summaryrefslogtreecommitdiff
path: root/django/contrib/postgres/forms/array.py
diff options
context:
space:
mode:
authorVinay Karanam <vinayinvicible@gmail.com>2018-01-03 12:10:14 +0530
committerTim Graham <timograham@gmail.com>2018-04-07 17:53:33 -0400
commit6a1957bb9887f8e0bb69d3d2b180a1414d38c1fc (patch)
tree911f7e0a8cdaad23601a4bb12f6b28bf8c1766b0 /django/contrib/postgres/forms/array.py
parente67dc0fbb2fc3d7c2c503b4cdc5b77ce4e944066 (diff)
downloaddjango-6a1957bb9887f8e0bb69d3d2b180a1414d38c1fc.tar.gz
Fixed #28950 -- Fixed ArrayField.has_changed() for empty values.
Diffstat (limited to 'django/contrib/postgres/forms/array.py')
-rw-r--r--django/contrib/postgres/forms/array.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/django/contrib/postgres/forms/array.py b/django/contrib/postgres/forms/array.py
index f01d5836c1..d9e3256e1f 100644
--- a/django/contrib/postgres/forms/array.py
+++ b/django/contrib/postgres/forms/array.py
@@ -91,6 +91,16 @@ class SimpleArrayField(forms.CharField):
if errors:
raise ValidationError(errors)
+ def has_changed(self, initial, data):
+ try:
+ value = self.to_python(data)
+ except ValidationError:
+ pass
+ else:
+ if initial in self.empty_values and value in self.empty_values:
+ return False
+ return super().has_changed(initial, data)
+
class SplitArrayWidget(forms.Widget):
template_name = 'postgres/widgets/split_array.html'