Add slug validator for org

This commit is contained in:
cuom1999 2023-01-25 13:13:42 -06:00
parent 3791d2e90f
commit 08fae0d0dc
2 changed files with 32 additions and 0 deletions

View file

@ -34,6 +34,9 @@ class Organization(models.Model):
verbose_name=_("organization slug"),
help_text=_("Organization name shown in URL"),
unique=True,
validators=[
RegexValidator("^[-a-zA-Z0-9]+$", _("Only alphanumeric and hyphens"))
],
)
short_name = models.CharField(
max_length=20,