#NEWLINE# def test_using_is_honored_inheritance( self ) : #NEWLINE# #INDENT# B = BookWithYear . objects . using ( 'other' ) #NEWLINE# A = AuthorWithAge . objects . using ( 'other' ) #NEWLINE# book1 = B . create ( title = 'Poems' , published_year = 2010 ) #NEWLINE# book2 = B . create ( title = 'More poems' , published_year = 2011 ) #NEWLINE# author1 = A . create ( name = 'Jane' , first_book = book1 , age = 50 ) #NEWLINE# author2 = A . create ( name = 'Tom' , first_book = book2 , age = 49 ) #NEWLINE# with self . assertNumQueries ( 2 , using = 'other' ) : #NEWLINE# #INDENT# authors = ', ' . join ( ( a . author . name for a in A . prefetch_related ( 'author' ) ) ) #NEWLINE# #UNINDENT# self . assertEqual ( authors , 'Jane, Tom' ) #NEWLINE# with self . assertNumQueries ( 2 , using = 'other' ) : #NEWLINE# #INDENT# ages = ', ' . join ( ( str ( a . authorwithage . age ) for a in A . prefetch_related ( 'authorwithage' ) ) ) #NEWLINE# #UNINDENT# self . assertEqual ( ages , '50, 49' )