feature/tests #18
@ -21,6 +21,13 @@ class RegisterViewSet(generics.GenericAPIView):
|
|||||||
def post(self, request):
|
def post(self, request):
|
||||||
serializer = self.get_serializer(data=request.data)
|
serializer = self.get_serializer(data=request.data)
|
||||||
if serializer.is_valid():
|
if serializer.is_valid():
|
||||||
|
data = self.request.data
|
||||||
|
User.objects.create(
|
||||||
|
email=data["email"],
|
||||||
|
first_name=data["first_name"],
|
||||||
|
last_name=data["last_name"],
|
||||||
|
password=data["password"]
|
||||||
|
)
|
||||||
return Response({"detail": "Done"}, status=status.HTTP_200_OK)
|
return Response({"detail": "Done"}, status=status.HTTP_200_OK)
|
||||||
else:
|
else:
|
||||||
return Response(data=serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
return Response(data=serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
Loading…
Reference in New Issue
Block a user