From 83f446fc475c8800298bbe5314659e82400a4709 Mon Sep 17 00:00:00 2001 From: Karol Sikora Date: Wed, 26 Nov 2014 16:06:21 +0100 Subject: [PATCH] Fixed get_component method in Field to get working with subclassess of collections.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 c0253f86b..a2d2d5feb 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 @@ -52,7 +53,7 @@ def get_component(obj, attr_name): Given an object, and an attribute name, return that attribute on the object. """ - if isinstance(obj, dict): + if isinstance(obj, collections.Mapping): val = obj.get(attr_name) else: val = getattr(obj, attr_name)