-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Description
Hi
I have an issue where I have two models A and B. B has a OneToOne field called a pointing to the A model, with related_name set to b.
Whenever I create A objects through the API and set the JSON b field to the ID of an existing B object, I get a 201 response (with the b key correctly set in the response body), but this relationship is actually not persisted in the database .
I have created a repo with a minimal implementation where this can be reproduced. It also includes a failing test.
I believe following issues/MRs reference the same problem, but I can't tell for sure:
- ModelSerializer: OneToOne reverse relationships don't save in create() #5996
- PR7554
- Save reverse OneToOne relations, possible fix for issue #5996 #7547
Originally posted by @pierremonico in #7987
Metadata
Metadata
Assignees
Labels
No labels