Answer the question
In order to leave comments, you need to log in
How to clone a Django model?
How to clone an object with all related models?
upd. There seems to be no built-in solution. It is necessary to recursively go through all the models and set them to pk=None and save. But it looks sad - a hundred requests in a row. Is it possible to combine a bunch of requests into one pack in django? Well, i.e. the code is executed, but only one combined query will go to the database?
Answer the question
In order to leave comments, you need to log in
Yes. You have to go through all the records.
Learn SQL already. Your "pack" is likely to be completed within a single transaction.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question