1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 19:02:33 +00:00

Fix trigram validation

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2024-06-13 11:03:10 +02:00
parent 2627b3a9b8
commit d84db949c6
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85

View File

@ -237,7 +237,7 @@ class Team(models.Model):
get_sympa_client().delete_list(f"equipe-{self.trigram}") get_sympa_client().delete_list(f"equipe-{self.trigram}")
def clean(self): def clean(self):
if len(self.trigram) != settings.TEAM_CODE_LENGTH: if self.trigram and len(self.trigram) != settings.TEAM_CODE_LENGTH:
raise ValidationError({'trigram': _("The team code must be composed of {nb_letters} uppercase letters.")}, raise ValidationError({'trigram': _("The team code must be composed of {nb_letters} uppercase letters.")},
params={'nb_letters': settings.TEAM_CODE_LENGTH}) params={'nb_letters': settings.TEAM_CODE_LENGTH})
return super().clean() return super().clean()