From 96861958990ccd9d5a418747584aa286797156b8 Mon Sep 17 00:00:00 2001 From: Luciano Almeida Date: Thu, 30 Jun 2016 15:58:42 -0300 Subject: [PATCH] =?UTF-8?q?Cria=20instancia=20de=20servidor=20somente=20se?= =?UTF-8?q?=20User=20n=C3=A3o=20for=20staff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Luciano Almeida --- sigi/apps/servidores/models.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sigi/apps/servidores/models.py b/sigi/apps/servidores/models.py index 58653cd..204fb5f 100644 --- a/sigi/apps/servidores/models.py +++ b/sigi/apps/servidores/models.py @@ -149,6 +149,7 @@ class Servidor(models.Model): # Soluçao alternativa para extender o usuário do django # Acessa do servidor de um objeto user criando um profile # baseado nos dados do LDAP + User.servidor = property(lambda user: Servidor.objects.get(user=user)) # Sinal para ao criar um usuário criar um servidor @@ -156,7 +157,7 @@ User.servidor = property(lambda user: Servidor.objects.get(user=user)) def create_user_profile(sender, instance, created, **kwargs): - if created: + if created and instance.is_staff: Servidor.objects.create( user=instance, nome_completo="%s %s" % (instance.first_name, instance.last_name)