Fix trigram validation
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
2627b3a9b8
commit
d84db949c6
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue