Replies: 1 comment
-
If you want to save the whole tree in one call you can call As of now |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have some models with different many to many relationships. For the sake of simplicity assume we have the two models
Chocolate
andAssortment
aChocolate
can be in differentAssortments
and aAssortment
contains multiple differentChocolate
entities.I've created endpoints with Fastapi for
chocolate
and created some entities and have their ids.Now I want to create an
Assortment
by passingto the
POST /assortment
endpoint. Of course I want to add theChocolate
entities to theAssortment
entity by only passing the ids.I haven't found a way for this that seems to be intended.
Do I have to break down the pydantic model (so that it ignores the ids) and then call
assortment.chocolates.add(...)
for everyChocolate
entity that I need to fetch from the database?Beta Was this translation helpful? Give feedback.
All reactions