1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #27922 -- Added ErrorDict.get_json_data().

This commit is contained in:
Tim Heap
2017-03-10 10:45:50 +11:00
committed by Tim Graham
parent 2f09a28558
commit 5b6181f4d5
4 changed files with 30 additions and 4 deletions

View File

@@ -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: