renator's picture
create table for text to speech and update the schemas for user creation as well
4b98fcb
raw
history blame
641 Bytes
from .serializers import UserSerializer
from rest_framework import status
from rest_framework.response import Response
from rest_framework.generics import CreateAPIView
from rest_framework.authtoken.models import Token
from django.contrib.auth.models import User
class RegisterView(CreateAPIView):
queryset = User.objects.all()
serializer_class = UserSerializer # Create a UserSerializer to handle user registration.
def perform_create(self, serializer):
user = serializer.save()
token, _ = Token.objects.get_or_create(user=user)
return Response({'token': token.key}, status=status.HTTP_201_CREATED)