Esempio n. 1
0
 def signup(self, request):
     ''' User signup '''
     serializer = UserSignUpSerializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     user = serializer.save()
     data = UserModelSerializer(user).data
     return Response(data, status=status.HTTP_201_CREATED)
Esempio n. 2
0
 def post(self, request, *args, **kwargs):
     """Handle HTTP POST request"""
     serializer = UserSignUpSerializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     user = serializer.save()
     data = UserModelSerializer(user).data
     return Response(data, status=status.HTTP_201_CREATED)
Esempio n. 3
0
 def signup(self, request):
     """User sign up."""
     request.data['username'] = '******'.format(request.data['first_name'],
                                               request.data['last_name'])
     serializer = UserSignUpSerializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     user = serializer.save()
     data = UserWithoutTeacherModelSerializer(user).data
     return Response(data, status=status.HTTP_201_CREATED)