aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/fields.py
diff options
context:
space:
mode:
Diffstat (limited to 'rest_framework/fields.py')
-rw-r--r--rest_framework/fields.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py
index 3ec28908..7496a629 100644
--- a/rest_framework/fields.py
+++ b/rest_framework/fields.py
@@ -51,8 +51,11 @@ def get_attribute(instance, attrs):
for attr in attrs:
try:
instance = getattr(instance, attr)
- except AttributeError:
- return instance[attr]
+ except AttributeError as exc:
+ try:
+ return instance[attr]
+ except (KeyError, TypeError):
+ raise exc
return instance