summaryrefslogtreecommitdiff
path: root/django/forms/utils.py
diff options
context:
space:
mode:
authorTim Heap <tim@timheap.me>2017-03-10 10:45:50 +1100
committerTim Graham <timograham@gmail.com>2017-05-27 09:19:42 -0400
commit5b6181f4d58f63e7d2b52ab94e162e5ce8980f12 (patch)
tree326c51473d07cec66b947927039d347d28fbfe0b /django/forms/utils.py
parent2f09a285582cb475a9d27067808d9beefa7f9fba (diff)
downloaddjango-5b6181f4d58f63e7d2b52ab94e162e5ce8980f12.tar.gz
Fixed #27922 -- Added ErrorDict.get_json_data().
Diffstat (limited to 'django/forms/utils.py')
-rw-r--r--django/forms/utils.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/forms/utils.py b/django/forms/utils.py
index e3151c9390..587cea85a3 100644
--- a/django/forms/utils.py
+++ b/django/forms/utils.py
@@ -51,8 +51,11 @@ class ErrorDict(dict):
def as_data(self):
return {f: e.as_data() for f, e in self.items()}
+ def get_json_data(self, escape_html=False):
+ return {f: e.get_json_data(escape_html) for f, e in self.items()}
+
def as_json(self, escape_html=False):
- return json.dumps({f: e.get_json_data(escape_html) for f, e in self.items()})
+ return json.dumps(self.get_json_data(escape_html))
def as_ul(self):
if not self: