From a346a269ca99caf3d0a3ae4e1cb798c9d7563f42 Mon Sep 17 00:00:00 2001 From: Samuel Sutch Date: Sat, 12 Jul 2014 22:07:58 -0600 Subject: [PATCH] go back to checking with Mapping --- rest_framework/fields.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index db98c62a5..d9ef0144f 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -10,6 +10,7 @@ import datetime import inspect import re import warnings +import collections from decimal import Decimal, DecimalException from django import forms from django.core import validators @@ -50,7 +51,7 @@ def get_component(obj, attr_name): Given an object, and an attribute name, return that attribute on the object. """ - if hasattr(obj, '__getitem__'): + if isinstance(obj, collections.Mapping): val = obj[attr_name] else: val = getattr(obj, attr_name)