mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-07-04 10:52:14 +02:00
Add forbidden trigrams, closes #17
This commit is contained in:
@ -39,7 +39,11 @@ class Team(models.Model):
|
||||
verbose_name=_("trigram"),
|
||||
help_text=_("The trigram must be composed of three uppercase letters."),
|
||||
unique=True,
|
||||
validators=[RegexValidator("[A-Z]{3}")],
|
||||
validators=[
|
||||
RegexValidator(r"^[A-Z]{3}$"),
|
||||
RegexValidator(fr"^(?!{'|'.join(f'{t}$' for t in settings.FORBIDDEN_TRIGRAMS)})",
|
||||
message=_("This trigram is forbidden.")),
|
||||
],
|
||||
)
|
||||
|
||||
access_code = models.CharField(
|
||||
|
Reference in New Issue
Block a user