mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-02 03:20:12 +03:00
fix bug when writing to a dotted field source when the last component doesnt yet exist on the related object
This commit is contained in:
parent
d5d97624f7
commit
cc5096e6e6
|
@ -69,7 +69,7 @@ def set_component(obj, attr_name, value):
|
|||
if isinstance(obj, dict):
|
||||
obj[attr_name] = value
|
||||
else:
|
||||
attr = getattr(obj, attr_name)
|
||||
attr = getattr(obj, attr_name, None)
|
||||
if six.callable(attr):
|
||||
raise TypeError("%r.%s is a method; can't set it" % (obj, attr_name))
|
||||
setattr(obj, attr_name, value)
|
||||
|
|
Loading…
Reference in New Issue
Block a user