summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/forms/utils.py b/django/forms/utils.py
index 587cea85a3..9bdaffa44b 100644
--- a/django/forms/utils.py
+++ b/django/forms/utils.py
@@ -95,7 +95,7 @@ class ErrorList(UserList, list):
def get_json_data(self, escape_html=False):
errors = []
for error in self.as_data():
- message = list(error)[0]
+ message = next(iter(error))
errors.append({
'message': escape(message) if escape_html else message,
'code': error.code or '',
@@ -133,7 +133,7 @@ class ErrorList(UserList, list):
def __getitem__(self, i):
error = self.data[i]
if isinstance(error, ValidationError):
- return list(error)[0]
+ return next(iter(error))
return error
def __reduce_ex__(self, *args, **kwargs):