Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions odata/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,14 @@ def _clean_new_entity(self, entity):
else:
if value.__odata__.id:
insert_data['{0}@odata.bind'.format(prop.name)] = value.__odata__.id

# Put the foreign key back into the request for compatibility with
# systems that don't handle {entity} odata.bind correctly
try:
insert_data[prop.foreign_key] = getattr(value, prop.foreign_key)
except:
pass

else:
insert_data[prop.name] = self._clean_new_entity(value)

Expand Down