aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Christie2014-11-27 12:22:14 +0000
committerTom Christie2014-11-27 12:22:14 +0000
commit67ae6b2552324ae25f31e71451ce6ff3cf2b79e4 (patch)
treef7ead8bb861c84784c08998d47549ec13fe7dc47
parent650a91ac24cbd3e5b4ad5d7d7c6706fdf6160a78 (diff)
parent83f446fc475c8800298bbe5314659e82400a4709 (diff)
downloaddjango-rest-framework-67ae6b2552324ae25f31e71451ce6ff3cf2b79e4.tar.bz2
Merge pull request #2140 from sicarrots/fix_get_component
Fixed get_component method in Field to get working with subclassess of collections.Mapping
-rw-r--r--rest_framework/fields.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py
index c0253f86..a2d2d5fe 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)