title: How to assign a logged in user automatically to a post In Django Rest framework?
body: <p>I have created a model to post an ad. Since the CreateApiView is protected so that only logged in user can create or post ad, but if the logged in user posts an ad how to automatically take the logged user name or assign that user to his ad?</p>
  
  <p>This is what I have tried in my viewsets </p>
  
  <pre><code>def perform_create(self, serializer):
      return serializer.save(owner=self.request.user)
  </code></pre>
  
  <p>this is my models.py </p>
  
  <pre><code>class Add(models.Model):
  CATEGORY_CHOICES = (
      (1, 'Khashi'),
      (2, 'Boka'),
      (3, 'Goat'),
      (4, 'Chyangra'),
      (5, 'Veda'),
  )
  user = models.ForeignKey(User, on_delete = models.CASCADE)
  title = models.CharField(("Title"), max_length=50)
  category = models.IntegerField(("Choose Category"), choices=CATEGORY_CHOICES)
  Short_discription = models.CharField(("Short Discription"), max_length=200)
  </code></pre>
  
  <p>this is my serializers.py</p>
  
  <pre><code>class KhashiSerializer(serializers.ModelSerializer):
      class Meta:
          model = Add
          fields = '__all__'
          read_only_fields = ['user']
  </code></pre>
  
  <p>this is my viewset</p>
  
  <pre><code>class KhashiCreateApiView(generics.CreateAPIView):
      queryset = Add.objects.all()
      serializer_class = KhashiSerializer
  
      def perform_create(self, serializer):
          serializer.save(user=self.request.user)
  </code></pre>
  
  <p>I'm getting this error with this endpoint <a href="http://127.0.0.1:8000/api/khashi/khashi_add" rel="nofollow noreferrer">http://127.0.0.1:8000/api/khashi/khashi_add</a></p>
  
  <pre><code>OperationalError at /api/khashi/khashi_add
  table add_khashi_add has no column named user_id
  </code></pre>
  
  <p>Is there any way to assign user to the post so that if POST reqest in Postman without <code>user</code> provided will automatically assign logged in user or user with Token that is provided in Authorization header??</p>