1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-11-14 16:21:34 +01:00

Fix linters + Fix translations

This commit is contained in:
Maxime JUST
2025-11-11 18:50:01 +01:00
parent c8eefb0991
commit 49729485b7
5 changed files with 293 additions and 296 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -80,13 +80,17 @@ class ParticipationForm(forms.ModelForm):
if settings.SINGLE_TOURNAMENT: if settings.SINGLE_TOURNAMENT:
del self.fields['tournament'] del self.fields['tournament']
self.helper = FormHelper() self.helper = FormHelper()
idf_text = _(
'For the tournaments in the region "Île-de-France": registration is '
'unified for each tournament. By choosing a tournament "Île-de-France", '
"you're accepting that your team may be selected for one of these tournaments. "
'In case of date conflict, please write them in your motivation letter.'
)
idf_warning_banner = f""" idf_warning_banner = f"""
<div class=\"alert alert-warning\"> <div class=\"alert alert-warning\">
<h5 class=\"alert-heading\">{_("IMPORTANT")}</h4> <h5 class=\"alert-heading\">{_("IMPORTANT")}</h4>
{_("""For the tournaments in the region "Île-de-France": registration is {idf_text}
unified for each tournament. By choosing a tournament "Île-de-France",
you're accepting that your team may be selected for one of these tournaments.
In case of date conflict, please write them in your motivation letter.""")}
</div> </div>
""" """
unified_registration_tournament_ids = ",".join( unified_registration_tournament_ids = ",".join(

View File

@@ -70,11 +70,11 @@ class Team(models.Model):
@property @property
def coaches(self): def coaches(self):
return self.participants.filter(coachregistration__isnull=False) return self.participants.filter(coachregistration__isnull=False)
@property @property
def scientific_coaches(self): def scientific_coaches(self):
return self.participants.filter(coachregistration__isnull=False, coachregistration__is_scientific_coach=True) return self.participants.filter(coachregistration__isnull=False, coachregistration__is_scientific_coach=True)
@property @property
def accompanying_coaches(self): def accompanying_coaches(self):
return self.participants.filter(coachregistration__isnull=False, coachregistration__is_accompanying_coach=True) return self.participants.filter(coachregistration__isnull=False, coachregistration__is_accompanying_coach=True)
@@ -219,7 +219,6 @@ class Team(models.Model):
:return: The mailing list to contact the team members. :return: The mailing list to contact the team members.
""" """
return f"equipe-{slugify(self.trigram)}@{settings.SYMPA_HOST}" return f"equipe-{slugify(self.trigram)}@{settings.SYMPA_HOST}"
def create_mailing_list(self): def create_mailing_list(self):
""" """

View File

@@ -251,8 +251,6 @@ class CoachRegistrationForm(forms.ModelForm):
""" """
A coach can tell its professional activity. A coach can tell its professional activity.
""" """
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)

View File

@@ -14,6 +14,8 @@ from django.urls import reverse, reverse_lazy
from django.utils import timezone, 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.encoding import force_bytes from django.utils.encoding import force_bytes
from django.utils.functional import lazy
from django.utils.html import format_html
from django.utils.http import urlsafe_base64_encode from django.utils.http import urlsafe_base64_encode
from django.utils.text import format_lazy from django.utils.text import format_lazy
from django.utils.timezone import localtime from django.utils.timezone import localtime
@@ -22,7 +24,8 @@ from phonenumber_field.modelfields import PhoneNumberField
from polymorphic.models import PolymorphicModel from polymorphic.models import PolymorphicModel
from tfjm import helloasso from tfjm import helloasso
from tfjm.tokens import email_validation_token from tfjm.tokens import email_validation_token
from django.utils.html import format_html
format_html_lazy = lazy(format_html, str)
class Registration(PolymorphicModel): class Registration(PolymorphicModel):
@@ -531,7 +534,7 @@ class CoachRegistration(ParticipantRegistration):
is_scientific_coach = models.BooleanField( is_scientific_coach = models.BooleanField(
default=False, default=False,
verbose_name=_("Scientific coach"), verbose_name=_("Scientific coach"),
help_text=format_html( help_text=format_html_lazy(
'{} <a href="{}" target="_blank" rel="noopener">{}</a>.', '{} <a href="{}" target="_blank" rel="noopener">{}</a>.',
_("Provides scientific guidance: methodology, content review, and project mentoring during the preparation phase."), _("Provides scientific guidance: methodology, content review, and project mentoring during the preparation phase."),
"https://tfjm.org/wp-content/uploads/2024/01/note____l_intention_des_encadrants.pdf", "https://tfjm.org/wp-content/uploads/2024/01/note____l_intention_des_encadrants.pdf",
@@ -542,9 +545,14 @@ class CoachRegistration(ParticipantRegistration):
is_accompanying_coach = models.BooleanField( is_accompanying_coach = models.BooleanField(
default=False, default=False,
verbose_name=_("Accompanying coach"), verbose_name=_("Accompanying coach"),
help_text=_("Accompanies the team during the weekend and stays for the entire tournament."), help_text=format_html_lazy(
'{} <a href="{}" target="_blank" rel="noopener">{}</a>.',
_("Accompanies the team during the weekend and stays for the entire tournament."),
"https://tfjm.org/wp-content/uploads/2025/11/Fiches_pratiques_TFJM2.pdf",
_("see practical sheet"),
)
) )
@property @property
def type(self): def type(self):
return _("coach") return _("coach")