Merge pull request #154 from cthulahoops/confusing_id_bug

Don't allow data source to change the primary key of an object.
This commit is contained in:
Mouse Reeve 2020-04-26 11:57:50 -07:00 committed by GitHub
commit 26139f7201
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,6 +70,9 @@ def update_from_mappings(obj, data, mappings):
if not formatter: if not formatter:
formatter = noop formatter = noop
if key == 'id':
continue
if has_attr(obj, key): if has_attr(obj, key):
obj.__setattr__(key, formatter(value)) obj.__setattr__(key, formatter(value))
return obj return obj