Empêche l'inscription à un tirage non ouvert
This commit is contained in:
parent
9728384629
commit
2a1c870cac
1 changed files with 6 additions and 0 deletions
|
@ -126,6 +126,12 @@ def places_ics(request, tirage_id):
|
||||||
@cof_required
|
@cof_required
|
||||||
def inscription(request, tirage_id):
|
def inscription(request, tirage_id):
|
||||||
tirage = get_object_or_404(Tirage, id=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:
|
if timezone.now() > tirage.fermeture:
|
||||||
participant, created = Participant.objects.get_or_create(
|
participant, created = Participant.objects.get_or_create(
|
||||||
user=request.user, tirage=tirage)
|
user=request.user, tirage=tirage)
|
||||||
|
|
Loading…
Reference in a new issue