reg again
This commit is contained in:
parent
45fd25ef70
commit
675571bccf
Binary file not shown.
|
|
@ -8,7 +8,8 @@ from django.contrib.auth.models import Permission
|
|||
@receiver(post_save, sender=User)
|
||||
def create_profile(sender, instance, created, **kwargs):
|
||||
if created:
|
||||
Profile.objects.create(user=instance, agency=instance.agency, parent=instance.parent)
|
||||
if(len(user_agency)) == 1:
|
||||
Profile.objects.create(user=instance, agency=instance.agency)
|
||||
|
||||
'''
|
||||
Wenn ein neuer Nutzer angelegt wird und dies der erste der Agentur ist,
|
||||
|
|
@ -22,7 +23,15 @@ def create_profile(sender, instance, created, **kwargs):
|
|||
tempperm = Permission.objects.get(codename=ele[0])
|
||||
tempuser.user_permissions.add(tempperm)
|
||||
tempuser.profile.func = 'lead'
|
||||
#tempuser.profile.parent = tempuser
|
||||
tempuser.profile.parent = tempuser
|
||||
tempuser.save()
|
||||
else:
|
||||
Profile.objects.create(user=instance, agency=instance.agency, parent=instance.parent)
|
||||
user_agency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||
tempuser.profile.func = 'external'
|
||||
tempuser.profile.parent=parent
|
||||
tempuser.profile.agency=agency
|
||||
tempuser.profile.user = user
|
||||
tempuser.save()
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue