mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-04-27 21:32:39 +00:00
Compare commits
3 Commits
fb10df77e5
...
c57ad854fe
Author | SHA1 | Date | |
---|---|---|---|
|
c57ad854fe | ||
|
a2e5ab5f6a | ||
|
758a2c9a00 |
@ -313,6 +313,7 @@ class TeamUpdateView(LoginRequiredMixin, UpdateView):
|
|||||||
instance=self.object.participation)
|
instance=self.object.participation)
|
||||||
if not self.request.user.registration.is_volunteer:
|
if not self.request.user.registration.is_volunteer:
|
||||||
del context["participation_form"].fields['final']
|
del context["participation_form"].fields['final']
|
||||||
|
context["participation_form"].helper.layout.remove('final')
|
||||||
context["title"] = _("Update team {trigram}").format(trigram=self.object.trigram)
|
context["title"] = _("Update team {trigram}").format(trigram=self.object.trigram)
|
||||||
return context
|
return context
|
||||||
|
|
||||||
@ -321,6 +322,7 @@ class TeamUpdateView(LoginRequiredMixin, UpdateView):
|
|||||||
participation_form = ParticipationForm(data=self.request.POST or None, instance=self.object.participation)
|
participation_form = ParticipationForm(data=self.request.POST or None, instance=self.object.participation)
|
||||||
if not self.request.user.registration.is_volunteer:
|
if not self.request.user.registration.is_volunteer:
|
||||||
del participation_form.fields['final']
|
del participation_form.fields['final']
|
||||||
|
participation_form.helper.layout.remove('final')
|
||||||
if not participation_form.is_valid():
|
if not participation_form.is_valid():
|
||||||
return self.form_invalid(form)
|
return self.form_invalid(form)
|
||||||
|
|
||||||
|
@ -7,8 +7,6 @@ from django.contrib.auth.forms import UserCreationForm
|
|||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.forms import FileInput
|
from django.forms import FileInput
|
||||||
from django.utils import timezone
|
|
||||||
from django.utils.text import format_lazy
|
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from .models import CoachRegistration, ParticipantRegistration, Payment, \
|
from .models import CoachRegistration, ParticipantRegistration, Payment, \
|
||||||
|
@ -70,7 +70,11 @@ ses propres moyens et sous la responsabilité du/de la représentant\cdt{}e lég
|
|||||||
|
|
||||||
\vspace{8ex}
|
\vspace{8ex}
|
||||||
|
|
||||||
Fait à \vrule width 10cm height 0pt depth 0.4pt, le \phantom{232323}/\phantom{XXX}/{% now "Y" %},
|
Fait à \vrule width 10cm height 0pt depth 0.4pt, le \phantom{232323}/\phantom{XXX}/{% now "Y" %}
|
||||||
|
|
||||||
|
\vspace{4ex}
|
||||||
|
|
||||||
|
Signature :
|
||||||
|
|
||||||
\vfill
|
\vfill
|
||||||
\vfill
|
\vfill
|
||||||
|
@ -18,7 +18,7 @@ from django.http import FileResponse, Http404
|
|||||||
from django.shortcuts import redirect, resolve_url
|
from django.shortcuts import redirect, resolve_url
|
||||||
from django.template.loader import render_to_string
|
from django.template.loader import render_to_string
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.utils import translation
|
from django.utils import timezone, translation
|
||||||
from django.utils.crypto import get_random_string
|
from django.utils.crypto import get_random_string
|
||||||
from django.utils.http import urlsafe_base64_decode
|
from django.utils.http import urlsafe_base64_decode
|
||||||
from django.utils.text import format_lazy
|
from django.utils.text import format_lazy
|
||||||
@ -60,22 +60,24 @@ class SignupView(CreateView):
|
|||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
@transaction.atomic
|
def get_form(self, form_class=None):
|
||||||
def form_valid(self, form):
|
form = super().get_form(form_class)
|
||||||
if not self.request.user.registration.is_admin:
|
if self.request.method in ("POST", "PUT") \
|
||||||
|
and (not self.request.user.is_authenticated or not self.request.user.registration.is_admin):
|
||||||
# Check that registrations are opened
|
# Check that registrations are opened
|
||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
if now < settings.REGISTRATION_DATES['open']:
|
if now < settings.REGISTRATION_DATES['open']:
|
||||||
form.add_error(None, format_lazy(_("Registrations are not opened yet. "
|
form.add_error(None, format_lazy(_("Registrations are not opened yet. "
|
||||||
"They will open on the {opening_date:%Y-%m-%d %H:%M}."),
|
"They will open on the {opening_date:%Y-%m-%d %H:%M}."),
|
||||||
opening_date=settings.REGISTRATION_DATES['open']))
|
opening_date=settings.REGISTRATION_DATES['open']))
|
||||||
elif now > settings.REGISTRATION_DATES['close']:
|
elif now > settings.REGISTRATION_DATES['close']:
|
||||||
form.add_error(None, format_lazy(_("Registrations for this year are closed since "
|
form.add_error(None, format_lazy(_("Registrations for this year are closed since "
|
||||||
"{closing_date:%Y-%m-%d %H:%M}."),
|
"{closing_date:%Y-%m-%d %H:%M}."),
|
||||||
closing_date=settings.REGISTRATION_DATES['close']))
|
closing_date=settings.REGISTRATION_DATES['close']))
|
||||||
if not form.is_valid():
|
return form
|
||||||
return self.form_invalid(form)
|
|
||||||
|
|
||||||
|
@transaction.atomic
|
||||||
|
def form_valid(self, form):
|
||||||
role = form.cleaned_data["role"]
|
role = form.cleaned_data["role"]
|
||||||
if role == "participant":
|
if role == "participant":
|
||||||
registration_form = StudentRegistrationForm(self.request.POST)
|
registration_form = StudentRegistrationForm(self.request.POST)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user