diff --git a/bda/templates/bda-attrib-extra.html b/bda/templates/bda-attrib-extra.html index 8ffccf34..4286dfc9 100644 --- a/bda/templates/bda-attrib-extra.html +++ b/bda/templates/bda-attrib-extra.html @@ -2,7 +2,7 @@ {% block extracontent %} -

Attribution (détails)

+

Attributions (détails)

Token :

{{ token }}

Placés : {{ total_slots }} ; Déçus : {{ total_losers }}

diff --git a/bda/templates/bda-attrib.html b/bda/templates/bda-attrib.html index f0bfd955..81540594 100644 --- a/bda/templates/bda-attrib.html +++ b/bda/templates/bda-attrib.html @@ -7,7 +7,12 @@ {% block realcontent %} -

Attribution

+

Attributions

+ +
+

Pensez à désactiver le lancement du tirage dès maintenant dans +l'interface admin

+

Token :

{{ token }}

Placés : {{ total_slots }} ; Déçus : {{ total_losers }}

diff --git a/bda/templates/bda-token.html b/bda/templates/bda-token.html index cbe72a76..b05a5b0d 100644 --- a/bda/templates/bda-token.html +++ b/bda/templates/bda-token.html @@ -8,6 +8,6 @@
{{ form.token }}
- + {% endblock %} diff --git a/bda/templates/tirage-failed.html b/bda/templates/tirage-failed.html new file mode 100644 index 00000000..a9f7e7d4 --- /dev/null +++ b/bda/templates/tirage-failed.html @@ -0,0 +1,9 @@ +{% extends "base_title.html" %} + +{% block realcontent %} +

Raté, le tirage ne peut pas être lancé !

+ +

Si vous savez ce que vous faites, vous pouvez autoriser le lancement du +tirage dans l'interface admin. +Pensez à le désactiver à nouveau ensuite.

+{% endblock %} diff --git a/bda/views.py b/bda/views.py index 1eab066d..7c10e0f2 100644 --- a/bda/views.py +++ b/bda/views.py @@ -181,11 +181,11 @@ def inscription(request, tirage_id): def do_tirage(request, tirage_id): tirage_elt = get_object_or_404(Tirage, id=tirage_id) + if not tirage_elt.enable_do_tirage: + return render(request, "tirage-failed.html", {'tirage': tirage_elt}) form = TokenForm(request.POST) if not form.is_valid(): return tirage(request) - tirage_elt.token = form.cleaned_data['token'] - tirage_elt.save() start = time.time() data = {} shows = tirage_elt.spectacle_set.select_related().all() @@ -235,16 +235,15 @@ def do_tirage(request, tirage_id): members2 = members2.items() data["members2"] = sorted(members2, key=lambda m: m[0].user.last_name) # À partir d'ici, le tirage devient effectif - # FIXME: Établir les conditions de validations (formulaire ?) - # cf. issue #32 - if False: - Attribution.objects.filter( - spectacle__tirage=tirage_elt - ).delete() - for (show, members, _) in results: - for (member, _, _, _) in members: - attrib = Attribution(spectacle=show, participant=member) - attrib.save() + Attribution.objects.filter(spectacle__tirage=tirage_elt).delete() + tirage_elt.tokens += "%s\n\"\"\"%s\"\"\"\n" % ( + timezone.now().strftime("%y-%m-%d %H:%M:%S"), + form.cleaned_data['token']) + tirage_elt.save() + for (show, members, _) in results: + for (member, _, _, _) in members: + attrib = Attribution(spectacle=show, participant=member) + attrib.save() return render(request, "bda-attrib-extra.html", data) else: return render(request, "bda-attrib.html", data) diff --git a/gestioncof/static/css/cof.css b/gestioncof/static/css/cof.css index d59e6ded..6cbc6c5d 100644 --- a/gestioncof/static/css/cof.css +++ b/gestioncof/static/css/cof.css @@ -246,6 +246,15 @@ fieldset legend { background-color: transparent; } +.important { + font-weight: bold; + color: #F90; +} + +.important a { + color: #F90; +} + #main form ul.errorlist li { font-weight: bold; color: #B00000;