#NEWLINE# def test_foreign_key_then_m2m( self ) : #NEWLINE# #INDENT# "\n        Test we can follow an m2m relation after a relation like ForeignKey\n        that doesn't have many objects\n        " #NEWLINE# with self . assertNumQueries ( 2 ) : #NEWLINE# #INDENT# qs = Author . objects . select_related ( 'first_book' ) . prefetch_related ( 'first_book__read_by' ) #NEWLINE# lists = [ [ six . text_type ( r ) for r in a . first_book . read_by . all ( ) ] for a in qs ] #NEWLINE# self . assertEqual ( lists , [ [ 'Amy' ] , [ 'Amy' ] , [ 'Amy' ] , [ 'Amy' , 'Belinda' ] ] )