Skip to content

Commit 67ae6b2

Browse files
committed
Merge pull request #2140 from sicarrots/fix_get_component
Fixed get_component method in Field to get working with subclassess of collections.Mapping
2 parents 650a91a + 83f446f commit 67ae6b2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rest_framework/fields.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import inspect
1111
import re
1212
import warnings
13+
import collections
1314
from decimal import Decimal, DecimalException
1415
from django import forms
1516
from django.core import validators
@@ -52,7 +53,7 @@ def get_component(obj, attr_name):
5253
Given an object, and an attribute name,
5354
return that attribute on the object.
5455
"""
55-
if isinstance(obj, dict):
56+
if isinstance(obj, collections.Mapping):
5657
val = obj.get(attr_name)
5758
else:
5859
val = getattr(obj, attr_name)

0 commit comments

Comments
 (0)