#NEWLINE# def get_all_related_objects_with_model( self , local_only = False , include_hidden = False , include_proxy_eq = False ) : #NEWLINE# #INDENT# '\n        Returns a list of (related-object, model) pairs. Similar to\n        get_fields_with_model().\n        ' #NEWLINE# try : #NEWLINE# #INDENT# self . _related_objects_cache #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# self . _fill_related_objects_cache ( ) #NEWLINE# #UNINDENT# predicates = [ ] #NEWLINE# if local_only : #NEWLINE# #INDENT# predicates . append ( ( lambda k , v : ( not v ) ) ) #NEWLINE# #UNINDENT# if ( not include_hidden ) : #NEWLINE# #INDENT# predicates . append ( ( lambda k , v : ( not k . field . rel . is_hidden ( ) ) ) ) #NEWLINE# #UNINDENT# cache = ( self . _related_objects_proxy_cache if include_proxy_eq else self . _related_objects_cache ) #NEWLINE# return [ t for t in cache . items ( ) if all ( ( p ( * t ) for p in predicates ) ) ]