from django.http.response import JsonResponse from rest_framework.views import APIView from server_auth.models import MindUser class MindUserView(APIView): """ 用户注册 """ def post(self, request): data_dict = request.POST user_name = data_dict.get('userName') input_password = data_dict.get('inputPassword') print('userName:%s,inputPassword:%s' % (user_name, input_password)) MindUser.objects.create_user(username=user_name, password=input_password, email='') return JsonResponse({"code": 0, "msg": "success"})