forked from mirrors/bookwyrm
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:
commit
26139f7201
1 changed files with 3 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue