#NEWLINE# def test_m2m_managers( self ) : #NEWLINE# #INDENT# 'M2M relations are represented by managers, and can be controlled like managers' #NEWLINE# pro = Book . objects . using ( 'other' ) . create ( pk = 1 , title = 'Pro Django' , published = datetime . date ( 2008 , 12 , 16 ) ) #NEWLINE# marty = Person . objects . using ( 'other' ) . create ( pk = 1 , name = 'Marty Alchin' ) #NEWLINE# pro_authors = pro . authors . using ( 'other' ) #NEWLINE# authors = [ marty ] #NEWLINE# self . assertEqual ( pro . authors . db , 'other' ) #NEWLINE# self . assertEqual ( pro . authors . db_manager ( 'default' ) . db , 'default' ) #NEWLINE# self . assertEqual ( pro . authors . db_manager ( 'default' ) . all ( ) . db , 'default' ) #NEWLINE# self . assertEqual ( self . book_set . db , 'other' ) #NEWLINE# self . assertEqual ( marty . book_set . db_manager ( 'default' ) . db , 'default' ) #NEWLINE# self . assertEqual ( marty . book_set . db_manager ( 'default' ) . all ( ) . db , 'default' )