Merge branch 'master' into Kerl/calendar

This commit is contained in:
Martin Pépin 2016-07-16 18:28:20 +02:00
commit 3d0e9d32c3
31 changed files with 391 additions and 231 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()
@ -120,7 +122,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):
@ -169,7 +171,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)
tirage_elt.token = form.cleaned_data['token']
tirage_elt.save()
start = time.time()
@ -198,7 +200,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
@ -252,7 +254,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 !