Utilise bulk_create dans le tirage

This commit is contained in:
Martin Pépin 2016-07-15 13:48:51 +02:00
parent 71b810695f
commit 92f672d573

View file

@ -251,10 +251,10 @@ def do_tirage(request, tirage_id):
form.cleaned_data['token'])
tirage_elt.enable_do_tirage = False
tirage_elt.save()
for (show, members, _) in results:
for (member, _, _, _) in members:
attrib = Attribution(spectacle=show, participant=member)
attrib.save()
Attribution.objects.bulk_create([
Attribution(spectacle=show, participant=member)
for show, members, _ in results
for member, _, _, _ in members])
return render(request, "bda-attrib-extra.html", data)
else:
return render(request, "bda-attrib.html", data)