From 92f672d573beb3033a234afd6fad5221ef01c3b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Fri, 15 Jul 2016 13:48:51 +0200 Subject: [PATCH] Utilise `bulk_create` dans le tirage --- bda/views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bda/views.py b/bda/views.py index dd53dbd2..df8274c4 100644 --- a/bda/views.py +++ b/bda/views.py @@ -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)