summaryrefslogtreecommitdiff
path: root/django/forms
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2019-07-19 13:55:32 -0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-07-23 20:12:08 +0200
commitd89053585e11e869efcc9debb1c311b47b5e20ea (patch)
tree94c606567d2611fb47914a59800af3d9ab2da6be /django/forms
parent8323691de0ba120dbdc8055063574df2b0c0afa4 (diff)
Improved error message when index in __getitem__() is invalid.
Diffstat (limited to 'django/forms')
-rw-r--r--django/forms/boundfield.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py
index 7f40fbbbb4..8832169021 100644
--- a/django/forms/boundfield.py
+++ b/django/forms/boundfield.py
@@ -63,7 +63,10 @@ class BoundField:
# Prevent unnecessary reevaluation when accessing BoundField's attrs
# from templates.
if not isinstance(idx, (int, slice)):
- raise TypeError
+ raise TypeError(
+ 'BoundField indices must be integers or slices, not %s.'
+ % type(idx).__name__
+ )
return self.subwidgets[idx]
@property