#NEWLINE# def get_reverse_related_filter( self , obj ) : #NEWLINE# #INDENT# '\n        Complement to get_forward_related_filter(). Return the keyword\n        arguments that when passed to self.related_field.model.object.filter()\n        select all instances of self.related_field.model related through\n        this field to obj. obj is an instance of self.model.\n        ' #NEWLINE# base_filter = { rh_field . attname : getattr ( obj , descriptor_filter . attname ) for ( lh_field , rh_field ) in self . related_fields } #NEWLINE# descriptor_filter = self . get_extra_descriptor_filter ( obj ) #NEWLINE# base_q = Q ( ** base_filter ) #NEWLINE# if isinstance ( descriptor_filter , dict ) : #NEWLINE# #INDENT# return ( base_q & Q ( ** descriptor_filter ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if descriptor_filter : #NEWLINE# #INDENT# return ( base_q & descriptor_filter ) #NEWLINE# #UNINDENT# #UNINDENT# return base_q