|
|
|
@ -32,17 +32,8 @@ class Account(models.Model):
@@ -32,17 +32,8 @@ class Account(models.Model):
|
|
|
|
|
@receiver(post_save, sender=User) |
|
|
|
|
def user_post_save_handler(sender, instance, created, **kwargs): |
|
|
|
|
if created: |
|
|
|
|
# We don't have ldap_user on creation, so just add the account |
|
|
|
|
account = Account(user=instance) |
|
|
|
|
account.save() |
|
|
|
|
else: |
|
|
|
|
# When we already have an account, |
|
|
|
|
# we can add the number form LDAP (mongo shit) |
|
|
|
|
if (hasattr(instance, 'ldap_user') and |
|
|
|
|
'employeenumber' in instance.ldap_user.attrs): |
|
|
|
|
instance.account.card_number = \ |
|
|
|
|
instance.ldap_user.attrs['employeenumber'][0] |
|
|
|
|
instance.account.save() |
|
|
|
|
|
|
|
|
|
@transaction.atomic |
|
|
|
|
def change_credit(self, amount, subject, desc): |
|
|
|
|