Here is my view. 

request.data has the 2 fields I am passing however serializer.validated_data 
has only prefs.


class AddToUserProfile(generics.CreateAPIView):
    permission_classes = 
(permissions.IsAuthenticatedOrReadOnly,IsOwnerOrReadOnly)
    serializer_class = UserPrefSerializer
    queryset = UserPrefs.objects.all()
    lookup_field = 'user_id'

    #def create(self,request,*args, **kwargs):
    def post(self, request, *args, **kwargs):
        serializer = UserPrefSerializer(data=request.data)
        print (repr(serializer))
        #user=request.user
        if serializer.is_valid():
            print ("validated_data")
            print (serializer.validated_data)  ## Here i get only prefs - 
ItemsView(OrderedDict([('prefs', 'Likes')]))
            print (request.data) ## Here I see both address as well as prefs 
{'address': 'XYZ', 'prefs': 'Likes'}
            serializer.create(serializer.validated_data)

-- 
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 django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a9d8abf8-f393-4a1a-a08f-839046da51ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to