def ajax_add_project(request):
    if not Method_check(request, 'POST'):  #限制请求方式
        return HttpResponse('请求方式错误')
    username = request.user.username
    name = request.POST.get('name')
    describe = request.POST.get('describe')
    payload = request.POST.get('payload')
    send_email = request.POST.get('send_email').title()
    diy_payload = request.POST.get('diy_payload')
    keep_alive = request.POST.get('keep_alive')
    parameter = request.POST.get('parameter')
    if not Value_check(name, describe, payload, send_email):  #检查字段完整
        return HttpResponse('{"status":500,"value":"请检查字段是否填写完整"}')
    if diy_payload == None:
        if (keep_alive != 'True'):
            if Value_check(parameter):
                result = ajax_add_project_func(username,
                                               name,
                                               describe,
                                               payload,
                                               send_email,
                                               parameter=parameter)
            else:
                result = ajax_add_project_func(username, name, describe,
                                               payload, send_email)
        else:
            result = ajax_add_project_func(username,
                                           name,
                                           describe,
                                           payload,
                                           send_email,
                                           keep_alive=keep_alive.title())
    else:
        result = ajax_add_project_func(username,
                                       name,
                                       describe,
                                       payload,
                                       send_email,
                                       diy_payload=diy_payload)
    return HttpResponse(
        '{' + '"status":{0},"value":"{1}"'.format(result[0], result[1]) + '}')
def user_changepass(request):  #修改密码
    if not Method_check(request, 'POST'):
        return HttpResponse('请求方式错误')
    result = change_pass(request)
    return HttpResponse(result)