Exemplo n.º 1
0
def save_task(request,user_id):
    data= json.loads(request.body)
    tTitledata = data.get('tTitle')
    tDescdata=data.get('tDesc')
    tStatusdata = data.get('tStatus')
    tAccessdata=data.get('tAccess')
    print tAccessdata
    userObject=User.objects.get(id=user_id)
    taskObject= Task(user=userObject, tTitle=tTitledata, tDesc=tDescdata, tStatus=tStatusdata, tAccess=tAccessdata)
    if taskObject:
        taskObject.save()
        return tasks(request,user_id)
Exemplo n.º 2
0
def authenticate_user(request):  
    data= json.loads(request.body)
    user_name = data.get('user_name')
    passw=data.get('passw')
    user = authenticate(username=user_name, password=passw)
    if user is not None:
    # the password verified for the user
        if user.is_active:
            uid=user.id
            request.session['u_id'] = uid
            return HttpResponse(uid)
    else:
    # the authentication system was unable to verify the username and password
        return("in-valid")