Replies: 1 comment
-
Unfortunately -> no, and its not When you choose bulk operation you sacrifice some functionality for speed of execution. One of the functionalities you sacrifice is the return value. Meaning bulk operations (usually In bulk_create in your example you would have to:
And since bulk operations don't update pks even if I would implement it (which would be quite complicated anyway given you need to save different models in different order depending on relation) the relations would brake (or even would raise exception in some cases). So either you have to split it into two bulk create, when you load just inserted payments to retrieve their pks and only then add payment_means and bulk_create payment_means (but you would have to somehow assign proper means to payments). If you would provide primary_keys for both models you can bulk_create them yet it's still needs to be divided in two calls - one per model. Other way is unfortunately the loop and saving one by one. |
Beta Was this translation helpful? Give feedback.
-
trying to preform bulk_create for a nested module.
payment --> payment_means
By query below I'm getting list of payments from src DB
Not sure for how initialize list of payment by a module Payment on target DB so could preform .
Q: How can i initialize list with a Module?
bulk_create :
Q - Can i preform bulk_create(follow=True, save_all=True) (same as done with save_all)for save the whole nested tree?
Beta Was this translation helpful? Give feedback.
All reactions