Hi Folks,

I'm getting this error when I declared like this:


def post(self, request):
        serializer = ProfileSerializer(data=request.data)
        username = request.user.username
        user_details = User.objects.get(username = username)
        if serializer.is_valid():
            serializer_data = serializer.save(commit=False)
            serializer_data.user = user_details
            serializer_data.save()

 File
"/home/sou/halanx/env/lib/python3.6/site-packages/rest_framework/serializers.py",
line 188, in save
    "'commit' is not a valid keyword argument to the 'save()' method. "
AssertionError: 'commit' is not a valid keyword argument to the 'save()'
method. If you need to access data before committing to the database then
inspect 'serializer.validated_data' instead. You can also pass additional
keyword arguments to 'save()' if you need to set extra attributes on the
saved model instance. For example: 'serializer.save(owner=request.user)'.'


please help me guys for this issue!!!

Thank You

Regards,
Soumen

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPUw6WZr696MOPGNk7pTdFKfERWGtiQuJbWVy3EiFLAz33y8Yw%40mail.gmail.com.

Reply via email to