#NEWLINE# def test_inline_formsets_with_multi_table_inheritance( self ) : #NEWLINE# #INDENT# AuthorBooksFormSet3 = inlineformset_factory ( Author , AlternateBook , can_delete = False , extra = 1 ) #NEWLINE# author = Author . objects . create ( pk = 1 , name = 'Charles Baudelaire' ) #NEWLINE# formset = AuthorBooksFormSet3 ( instance = author ) #NEWLINE# self . assertEqual ( len ( formset . forms ) , 1 ) #NEWLINE# self . assertHTMLEqual ( formset . forms [ 0 ] . as_p ( ) , '<p><label for="id_alternatebook_set-0-title">Title:</label> <input id="id_alternatebook_set-0-title" type="text" name="alternatebook_set-0-title" maxlength="100" /></p>\n<p><label for="id_alternatebook_set-0-notes">Notes:</label> <input id="id_alternatebook_set-0-notes" type="text" name="alternatebook_set-0-notes" maxlength="100" /><input type="hidden" name="alternatebook_set-0-author" value="1" id="id_alternatebook_set-0-author" /><input type="hidden" name="alternatebook_set-0-book_ptr" id="id_alternatebook_set-0-book_ptr" /></p>' ) #NEWLINE# data = { #NEWLINE# #INDENT# 'alternatebook_set-TOTAL_FORMS' : '1' , #NEWLINE# 'alternatebook_set-INITIAL_FORMS' : '0' , #NEWLINE# 'alternatebook_set-MAX_NUM_FORMS' : '' , #NEWLINE# 'alternatebook_set-0-title' : 'Flowers of Evil' , #NEWLINE# 'alternatebook_set-0-notes' : 'English translation of Les Fleurs du Mal' , #NEWLINE# #UNINDENT# } #NEWLINE# formset = AuthorBooksFormSet3 ( data , instance = author ) #NEWLINE# self . assertTrue ( formset . is_valid ( ) ) #NEWLINE# saved = formset . save ( ) #NEWLINE# self . assertEqual ( len ( saved ) , 1 ) #NEWLINE# ( book1 , ) = saved #NEWLINE# self . assertEqual ( author . title , 'Flowers of Evil' ) #NEWLINE# self . assertEqual ( book1 . notes , 'English translation of Les Fleurs du Mal' )