def METHOD_NAME(request):
    sign_up_enabled = SysConfig().get("sign_up_enabled", False)
    if not sign_up_enabled:
        result = {"status": 1, "msg": "注册未启用,请联系管理员开启", "data": None}
        return HttpResponse(json.dumps(result), content_type="application/json")
    username = request.POST.get("username")
    password = request.POST.get("password")
    password2 = request.POST.get("password2")
    display = request.POST.get("display")
    email = request.POST.get("email")
    result = {"status": 0, "msg": "ok", "data": None}
    if not (username and password):
        result["status"] = 1
        result["msg"] = "用户名和密码不能为空"
    elif len(Users.objects.filter(username=username)) > 0:
        result["status"] = 1
        result["msg"] = "用户名已存在"
    elif password != password2:
        result["status"] = 1
        result["msg"] = "两次输入密码不一致"
    elif not display:
        result["status"] = 1
        result["msg"] = "请填写中文名"
    else:
        # 验证密码
        try:
            validate_password(password)
            Users.objects.create_user(
                username=username,
                password=password,
                display=display,
                email=email,
                is_active=1,
                is_staff=True,
            )
        except ValidationError as msg:
            result["status"] = 1
            result["msg"] = str(msg)
    return HttpResponse(json.dumps(result), content_type="application/json")