Пример #1
0
def create_kuterless_user(  user_name, password, first_name = None, last_name = None, email = None, recieve_updates = True, description= None, location_desc = None, followed_discussions_tags = None, segment = None):
    
                
    if User.objects.filter( username = user_name ).count() != 0:
        
        return None
    
    user = User(
            username=user_name,
            email=email,
            first_name=first_name,
            last_name=last_name
        )

    user.set_password(password)
    user.save()    
    init_user_profile(user, segment)
    init_user_account(user)
    init_user_token(user)
    user.userprofile.recieve_updates = recieve_updates
    user.userprofile.description = description
    user.userprofile.location_desc = location_desc
    user.userprofile.save()
    
    return user



    
Пример #2
0
def create_kuterless_user(  user_name, password, first_name = None, last_name = None, email = None, recieve_updates = True):
    
                
    if User.objects.filter( username = user_name ).exists():
        
        return None
    
    user = User(
            username=user_name,
            email=email,
            first_name=first_name,
            last_name=last_name
        )

    user.set_password(password)
    user.save()    
    init_user_profile(user)
    init_user_account(user)
    init_user_token(user)
    user.userprofile.recieve_updates = recieve_updates
    user.userprofile.save()
    
    return user
Пример #3
0
 def setUp(self):
     self.admin = User.objects.create_user('admin', '*****@*****.**',
                                           'secret')
     self.at1 = User.objects.create_user('at1', '*****@*****.**',
                                           'secret')
     self.at2 = User.objects.create_user('at2', '*****@*****.**',
                                           'secret')
     self.at3 = User.objects.create_user('at3', '*****@*****.**',
                                           'secret')
     
     
     init_user_profile(self.admin)
     init_user_profile(self.at1)
     init_user_profile(self.at2)
     init_user_profile(self.at3)
     
     init_user_account(self.admin)
     init_user_account(self.at1)
     init_user_account(self.at2)
     init_user_account(self.at3)