From 7f06776d559189605e6424924de3257b946e5010 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 11 Oct 2016 17:11:46 +0200 Subject: [PATCH] =?UTF-8?q?Coh=C3=A9rence=20du=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- users/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/users/models.py b/users/models.py index 63ef614b..1af9009e 100644 --- a/users/models.py +++ b/users/models.py @@ -108,7 +108,7 @@ class User(AbstractBaseUser): surname = models.CharField(max_length=255) pseudo = models.CharField(max_length=32, unique=True, help_text="Doit contenir uniquement des lettres, chiffres, ou tirets", validators=[linux_user_validator]) email = models.EmailField() - school = models.ForeignKey('School', on_delete=models.PROTECT, null=False, blank=False) + school = models.ForeignKey('School', on_delete=models.PROTECT, null=True, blank=True) shell = models.ForeignKey('ListShell', on_delete=models.PROTECT, null=True, blank=True) comment = models.CharField(help_text="Commentaire, promo", max_length=255, blank=True) room = models.OneToOneField('topologie.Room', on_delete=models.PROTECT, blank=True, null=True) @@ -235,9 +235,9 @@ class User(AbstractBaseUser): def ldap_sync(self, base=True, access_refresh=True, mac_refresh=True): self.refresh_from_db() try: - user_ldap = LdapUser.objects.get(uidNumber=self.id) + user_ldap = LdapUser.objects.get(uidNumber=self.uid_number) except LdapUser.DoesNotExist: - user_ldap = LdapUser(uidNumber=self.id) + user_ldap = LdapUser(uidNumber=self.uid_number) if base: user_ldap.name = self.pseudo user_ldap.sn = self.pseudo