apps: do not allow to move an existing agent in the OU usagers

This commit is contained in:
Benjamin Dauvergne 2017-11-20 11:02:21 +01:00
parent 470e3102c5
commit a413a0ace2
1 changed files with 2 additions and 0 deletions

View File

@ -155,6 +155,8 @@ class AppConfig(django.apps.AppConfig):
'generate_password']:
del form.fields[field_name]
form.fields['email'].required = True
# do not allow to move an agent in the usagers OU
form.fields['ou'].queryset = form.fields['ou'].queryset.exclude(slug='usagers')
# Si un compte est validé, on interdit la modification des attributs coeurs
if form.instance.attributes.validated: