This is my APIview:
class Comments(ListCreateAPIView):
queryset = models.NewsComment.objects
filter_backends = [CommentsFilterBackend]
http_method_names = ["get", "post"]
def get_serializer(self, *args, **kwargs):
if self.request.method = "get":
return Myserializer
I want to know why self.request can call the "method". Isn't it the encapsulated Request new object? The native request object is encapsulated in Request obj. Why can self.request call the request.method attrs?