#NEWLINE# def in_bulk( self , id_list ) : #NEWLINE# #INDENT# '\n        Returns a dictionary mapping each of the given IDs to the object with\n        that ID.\n        ' #NEWLINE# assert self . query . can_filter ( ) , "Cannot use 'limit' or 'offset' with in_bulk" #NEWLINE# if ( not id_list ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# qs = self . filter ( pk__in = id_list ) . order_by ( ) #NEWLINE# return dict ( [ ( obj . _get_pk_val ( ) , self ) for obj in qs ] )