Empêche l'inscription à un tirage non ouvert

This commit is contained in:
Martin Pépin 2016-06-06 19:22:01 +02:00
parent 9728384629
commit 2a1c870cac

View file

@ -126,6 +126,12 @@ def places_ics(request, tirage_id):
@cof_required
def inscription(request, tirage_id):
tirage = get_object_or_404(Tirage, id=tirage_id)
if timezone.now() < tirage.ouverture:
error_desc = "Ouverture le %s" % (
tirage.ouverture.strftime('%d %b %Y à %H:%M'))
return render(request, 'resume_inscription.html',
{ "error_title": "Le tirage n'est pas encore ouvert !",
"error_description": error_desc })
if timezone.now() > tirage.fermeture:
participant, created = Participant.objects.get_or_create(
user=request.user, tirage=tirage)