Commit 83f446fc by Karol Sikora

Fixed get_component method in Field to get working with subclassess of collections.Mapping

parent 650a91ac
...@@ -10,6 +10,7 @@ import datetime ...@@ -10,6 +10,7 @@ import datetime
import inspect import inspect
import re import re
import warnings import warnings
import collections
from decimal import Decimal, DecimalException from decimal import Decimal, DecimalException
from django import forms from django import forms
from django.core import validators from django.core import validators
...@@ -52,7 +53,7 @@ def get_component(obj, attr_name): ...@@ -52,7 +53,7 @@ def get_component(obj, attr_name):
Given an object, and an attribute name, Given an object, and an attribute name,
return that attribute on the object. return that attribute on the object.
""" """
if isinstance(obj, dict): if isinstance(obj, collections.Mapping):
val = obj.get(attr_name) val = obj.get(attr_name)
else: else:
val = getattr(obj, attr_name) val = getattr(obj, attr_name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment