@detail_route(methods=['post', 'get'])
def comment(self, request, **kwargs):
    user = self.get_object()
self.queryset = Comment.objects.filter(recipient=user.id)
self.serializer_class = CommentFlat
if request.method == 'POST':
    data = {'comment': request.data['comment'], 'rating': request.data[
        'rating'], 'author': request.data['author'], 'recipient': user.id}
serializer = CommentFlat(data=data)
if serializer.is_valid():
    serializer.save()
Overriding Django REST ViewSet with custom post method and model