#NEWLINE# @ detail_route ( methods = [ 'get' ] , url_path = 'more-like-this' ) #NEWLINE# def more_like_this( self , request , pk = None ) : #NEWLINE# #INDENT# "\n        Sets up a detail route for ``more-like-this`` results.\n        Note that you'll need backend support in order to take advantage of this.\n\n        This will add ie. ^search/{pk}/more-like-this/$ to your existing ^search pattern.\n        " #NEWLINE# queryset = self . filter_queryset ( self . get_queryset ( ) ) #NEWLINE# mlt_queryset = queryset . more_like_this ( self . get_object ( ) . object ) #NEWLINE# page = self . paginate_queryset ( mlt_queryset ) #NEWLINE# if ( page is not None ) : #NEWLINE# #INDENT# serializer = self . get_serializer ( page , many = True ) #NEWLINE# return self . get_paginated_response ( serializer . data ) #NEWLINE# #UNINDENT# serializer = self . get_serializer ( mlt_queryset , many = True ) #NEWLINE# return Response ( serializer . data )