In my opinion, I save data in several models:
def myview(request):
How can I ensure rollback of model1.save() if model2.save() throws an error? Or how to make a commit only after successfully saving both models?
In other words, "only save model1 and model2 if both save () are successful," or "perform both saves within the transaction."
source share