Skip to content

How can I fix autoincrement returning null #496

Answered by collerek
Inkapa asked this question in Q&A
Discussion options

You must be logged in to vote

save saves only the main model, to save the whole tree including relations you need to use save_related https://collerek.github.io/ormar/models/methods/#save_related.

Otherwise, child models are not saved and you get back unsaved data (that's why they are missing the pk column)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Inkapa
Comment options

Answer selected by Inkapa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants