#NEWLINE# def get_object( self ) : #NEWLINE# #INDENT# '\n        Incase the lookup is on an object that has been hyperlinked\n        then update the queryset filter appropriately\n        ' #NEWLINE# if ( self . kwargs . get ( self . lookup_field , None ) is None ) : #NEWLINE# #INDENT# raise ParseError ( ( 'Expected URL keyword argument `%s`.' % self . lookup_field ) ) #NEWLINE# #UNINDENT# queryset = self . filter_queryset ( self . get_queryset ( ) ) #NEWLINE# filter_kwargs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# serializer = self . get_serializer ( ) #NEWLINE# lookup_field = self . lookup_field #NEWLINE# if ( self . lookup_field in serializer . get_fields ( ) ) : #NEWLINE# #INDENT# k = serializer . get_fields ( ) [ self . lookup_field ] #NEWLINE# if isinstance ( k , serializers . HyperlinkedRelatedField ) : #NEWLINE# #INDENT# lookup_field = ( '%s__%s' % ( self . lookup_field , k . lookup_field ) ) #NEWLINE# #UNINDENT# #UNINDENT# filter_kwargs [ lookup_field ] = self . kwargs [ self . lookup_field ] #NEWLINE# obj = get_object_or_404 ( queryset , ** filter_kwargs ) #NEWLINE# self . check_object_permissions ( filter_kwargs . request , obj ) #NEWLINE# return obj