Tirage utilisable et plus joli

- Ajout de balises `<pre>` pour mettre en valeur le token
- On remplace la condition sur les utilisateurs par le décorateur
  `@buro_required`
This commit is contained in:
Martin Pépin 2016-06-05 13:59:24 +02:00
parent 9ad14e7257
commit dfd4fb7d83
3 changed files with 11 additions and 9 deletions

View file

@ -3,7 +3,8 @@
{% block extracontent %} {% block extracontent %}
<h1>Attribution (détails)</h1> <h1>Attribution (détails)</h1>
<h2>Token : {{ token }}</h2> <h2>Token :</h2>
<pre>{{ token }}</pre>
<h2>Placés : {{ total_slots }} ; Déçus : {{ total_losers }}</h2> <h2>Placés : {{ total_slots }} ; Déçus : {{ total_losers }}</h2>
<table> <table>

View file

@ -8,7 +8,8 @@
{% block realcontent %} {% block realcontent %}
<h1>Attribution</h1> <h1>Attribution</h1>
<h2>Token : {{ token }}</h2> <h2>Token :</h2>
<pre>{{ token }}</pre>
<h2>Placés : {{ total_slots }} ; Déçus : {{ total_losers }}</h2> <h2>Placés : {{ total_slots }} ; Déçus : {{ total_losers }}</h2>
{% if user.profile.is_buro %}<h2>Déficit total: {{ total_deficit }} €, Opéra: {{ opera_deficit }} €, Attribué: {{ total_sold }} €</h2>{% endif %} {% if user.profile.is_buro %}<h2>Déficit total: {{ total_deficit }} €, Opéra: {{ opera_deficit }} €, Attribué: {{ total_sold }} €</h2>{% endif %}
<h2>Temps de calcul : {{ duration|floatformat }}s</h2> <h2>Temps de calcul : {{ duration|floatformat }}s</h2>

View file

@ -214,17 +214,17 @@ def do_tirage(request, tirage_id):
member.total += show.price member.total += show.price
members2 = members2.items() members2 = members2.items()
data["members2"] = sorted(members2, key=lambda m: m[0].user.last_name) data["members2"] = sorted(members2, key=lambda m: m[0].user.last_name)
if False and request.user.username in ["seguin", "harazi","fromherz", "ccadiou"]: # À partir d'ici, le tirage devient effectif
Attribution.objects.all().delete() Attribution.objects.all().delete()
for (show, members, _) in results: for (show, members, _) in results:
for (member, _, _, _) in members: for (member, _, _, _) in members:
attrib = Attribution(spectacle=show, participant=member) attrib = Attribution(spectacle=show, participant=member)
attrib.save() attrib.save()
return render(request, "bda-attrib-extra.html", data) return render(request, "bda-attrib-extra.html", data)
else: else:
return render(request, "bda-attrib.html", data) return render(request, "bda-attrib.html", data)
@login_required @buro_required
def tirage(request, tirage_id): def tirage(request, tirage_id):
if request.POST: if request.POST:
form = TokenForm(request.POST) form = TokenForm(request.POST)