mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 03:13:12 +00:00
Ajout validateur pour default_home_path
This commit is contained in:
parent
378c8e5392
commit
aebe93097b
1 changed files with 6 additions and 1 deletions
|
@ -30,6 +30,7 @@ from django.db import models
|
||||||
from django.db.models.signals import post_save
|
from django.db.models.signals import post_save
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
|
from django.core.validators import RegexValidator
|
||||||
from django.forms import ValidationError
|
from django.forms import ValidationError
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
@ -101,7 +102,11 @@ class OptionalUser(AclMixin, PreferencesModel):
|
||||||
default_home_path = models.CharField(
|
default_home_path = models.CharField(
|
||||||
max_length = 256,
|
max_length = 256,
|
||||||
default = "/home/{0}",
|
default = "/home/{0}",
|
||||||
help_text = "Chemin par défaut du home des utilisateurs, formaté avec le pseudo"
|
help_text = "Chemin par défaut du home des utilisateurs, où {0} est remplacé par le pseudo",
|
||||||
|
validators=[RegexValidator(
|
||||||
|
r'^/.*\{0\}.*$',
|
||||||
|
message=("Le chemin doit commencer par un / et contenir \"{0}\"")
|
||||||
|
)]
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
Loading…
Reference in a new issue