Improve performance of voucher bulk creation

This commit is contained in:
Raphael Michel
2018-02-26 10:40:57 +01:00
parent 1c01e23867
commit 0d1f424425
3 changed files with 17 additions and 8 deletions

View File

@@ -179,6 +179,6 @@ class VoucherBulkForm(VoucherForm):
data['code'] = code
data['bulk'] = True
del data['codes']
obj.save()
objs.append(obj)
Voucher.objects.bulk_create(objs)
return objs