title: How to get request params in Django rest framework on ListCreateAPIView
body: <p>I am creating a private message app with Django Rest Framework and Swagger for document the API. I am newbie on this framework and I not sure if ListCreateAPIView is the correct way to do that. I need the following endpoints:</p>
  <ul>
  <li>List all messages given the sender and the receiver.</li>
  <li>Post messages given the sender and the receiver.</li>
  <li>Delete messages given the sender and the receiver.</li>
  </ul>
  <p>My question is how to get the sender ID and the receiver ID from URL?</p>
  <p>Here is my code and any change on every part including Serializer and Model is welcome. Thanks in advance.</p>
  <pre><code>    class Message(models.Model):
          sender = models.ForeignKey(
              UserProfile, on_delete=models.CASCADE, related_name='sender')
          receiver = models.ForeignKey(
              UserProfile, on_delete=models.CASCADE, related_name='receiver')
          message = models.CharField(max_length=1200)
          createdAt = models.DateTimeField(auto_now_add=True)
          is_read = models.BooleanField(default=False)
      
          def __str__(self):
              return self.message
      
          class Meta:
              ordering = ('createdAt',)
  </code></pre>
  <pre><code>    class MessageSerializer(serializers.ModelSerializer):
          &quot;&quot;&quot;For Serializing Message&quot;&quot;&quot;
          sender = serializers.SlugRelatedField(
              many=False, slug_field='username', queryset=UserProfile.objects.all())
          receiver = serializers.SlugRelatedField(
              many=False, slug_field='username', queryset=UserProfile.objects.all())
      
          class Meta:
              model = Message
              fields = ['sender', 'receiver', 'message', 'createdAt']
  </code></pre>
  <pre><code>class MessageViewSet(ListCreateAPIView):
  
      serializer_class = MessageSerializer
      queryset = Message.objects.all()
  
      def list(self, request, *args, **kwargs):
          queryset = Message.objects.all()
          serializer = MessageSerializer(queryset)
          print(self.request.data)
          print(kwargs)
          return Response(serializer.data)
  </code></pre>
  <pre><code>router = DefaultRouter()
  router.register('messages', MessageViewSet.as_view(), basename='messages')
  
  urlpatterns = [
      path('', include(router.urls)),
  ]
  
  </code></pre>