Cannot add user in django rest framework

Im trying to make an API to register a new user, but I can't and I really don't know why. Im beginner.

def register_view(request):
    s = serializers.CreateUserSerializer(
    if s.is_valid():
    return Response(s.errors)

class CreateUserSerializer(serializers.ModelSerializer):
    class Meta:
        model = User
        fields = ['email', 'username', 'password']
        extra_kwargs = {'password': {'write_only': True}}

    def create(self, validated_data):
        user = User(
        return user

Error i get:

{"username":["This field is required."],"password":["This field is required."]}

im simply sending data using postman

Back to Top