profiles_app/views.py
def post(self,request):
        """Create a hello message with our name"""
        serializer = self.serializer_class(data=request.data)

        if serializer.is_valid():
            name = serializer.validated_data.get('name')
            message = f'Hello {name}'
            return Response ({'message': message})
        else:
            return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
Create a hello message with our name
Create a hello message with our name
Create a hello message with our name
def post(self,request):
        serializer = self.serializer_class(data=request.data)
        if serializer.is_valid():
            name = serializer.validated_data.get('name')
            message = f'Hello {name}'
            return Response ({'message': message})
        else:
            return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
def post ( self , request ) : serializer = self . serializer_class ( data = request . data ) if serializer . is_valid ( ) : name = serializer . validated_data . get ( 'name' ) message = f'Hello {name}' return Response ( { 'message' : message } ) else : return Response ( serializer . errors , status = status . HTTP_400_BAD_REQUEST )
Create a hello message with our name
Create a hello message with our name
"""Create a hello message with our name"""
self
request