Beispiel #1
0
def create_user(user):    
    status_code =""
    try
       new_user = User()
       new_user.user_name = user.POST['user_name']
       new_user.first_name = user.POST['first_name']
       new_user.last_name = user.POST['last_name']
       new_user.group = user.POST['group'] 
       status_code = "201"
    except
       status_code = "401"
    return HttpResponse(status_code)
Beispiel #2
0
def create_user(user_name, email_address, password='dummy', permission_prototype='public') :
    """create a User
    """


    if User.objects.filter(username=user_name).count() < 0 :
        user = User.objects.get(username=user_name)
    else :

        user = User(username=user_name, password=password, email=email_address)
        user.email_address=email_address
        user.user_name = user_name
        user.save()
        
        setup_user_security(user, permission_prototype)

        user.create_Profile(user,user=user)

    return user
Beispiel #3
0
def create_user(user_name, email_address, password='dummy', permission_prototype='public') :
    """create a User
    """

    if User.objects.filter(username=user_name).count() < 0 :
        user = User.objects.get(username=user_name)
    else :

        user = User(username=user_name, password=password, email=email_address)
        user.email_address=email_address
        user.user_name = user_name
        user.active = 1 # need this to be set before the save, below

        user.save()
        
        user_post_create(user)

        from apps.synced import post_user_create
        post_user_create.send(sender=user,user=user)

    return user