Merge branch 'master' into Kerl/fix_32_do_tirage

This commit is contained in:
Martin Pépin 2016-07-16 18:31:36 +02:00
commit 6d613def4c
30 changed files with 368 additions and 163 deletions

View file

@ -1,6 +1,8 @@
# coding: utf-8
# -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required
@ -64,7 +66,7 @@ def etat_places(request, tirage_id):
def _hash_queryset(queryset):
data = serializers.serialize("json", queryset)
data = serializers.serialize("json", queryset).encode()
hasher = hashlib.sha256()
hasher.update(data)
return hasher.hexdigest()
@ -145,7 +147,7 @@ def inscription(request, tirage_id):
return render(request, "resume_inscription.html",
{"error_title": "C'est fini !",
"error_description":
u"Tirage au sort dans la journée !",
"Tirage au sort dans la journée !",
"choices": choices})
def formfield_callback(f, **kwargs):
@ -194,7 +196,7 @@ def do_tirage(request, tirage_id):
tirage_elt = get_object_or_404(Tirage, id=tirage_id)
form = TokenForm(request.POST)
if not form.is_valid():
return tirage(request)
return tirage(request, tirage_id)
start = time.time()
data = {}
shows = tirage_elt.spectacle_set.select_related().all()
@ -221,7 +223,7 @@ def do_tirage(request, tirage_id):
deficit = (show.slots - len(members)) * show.price
total_sold += show.slots * show.price
if deficit >= 0:
if u"Opéra" in show.location.name:
if "Opéra" in show.location.name:
opera_deficit += deficit
total_deficit += deficit
data["total_sold"] = total_sold - total_deficit
@ -279,7 +281,7 @@ def do_resell(request, form):
spectacle = form.cleaned_data["spectacle"]
count = form.cleaned_data["count"]
places = "2 places" if count == "2" else "une place"
mail = u"""Bonjour,
mail = """Bonjour,
Je souhaite revendre %s pour %s le %s (%s) à %.02f.
Contactez moi par email si vous êtes intéressé·e·s !