I use the following utility function in several scripts:
@transaction.commit_on_success
def save_something(arg):
# creation of a model_instance using arg
model_instance.save()
In one of the scripts I upload lots of these model isntances to the database. In order to make this efficient I try to do:
@transaction.commit_manually
def save_many(arg_list):
for i,arg in enumerate(arg_list):
save_something(arg)
if i%1000==0:
transaction.commit()
Does the commit_manually
override the commit_on_success
?
If not, how can I make it?