I am developing an application in django-rest-framework. Following is my serializer:
class MySerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = My
fields = ('user','title','description')
The problem is that when I run it, it asks for the user to be selected like this:
I want that whichever user is logged in, he should be added to user field automatically. In django website development, I used to do it using request.user
but how do I do it in django rest framework?