Skip to content

Commit

Permalink
Fix setting to-one relationship value to None
Browse files Browse the repository at this point in the history
Signed-off-by: Igor Kotrasinski <i.kotrasinsk@gmail.com>
  • Loading branch information
Igor Kotrasinski committed Jun 25, 2018
1 parent 730c3e5 commit f19c59d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/jsonapi_client/relationships.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ def as_json_resource_identifiers(self) -> dict:
return None
return self._resource_identifier.as_resource_identifier_dict()

def _value_to_identifier(self, value: R_IDENT_TYPES, type_: str='') \
-> 'Union[ResourceIdentifier, ResourceObject]':
if value is None:
return None
return super()._value_to_identifier(value, type_)

def set(self, new_value: R_IDENT_TYPES, type_: str='') -> None:

self._resource_identifier = self._value_to_identifier(new_value, type_)
Expand Down

0 comments on commit f19c59d

Please sign in to comment.