#NEWLINE# def test_deletion( self ) : #NEWLINE# #INDENT# PoemFormSet = inlineformset_factory ( Poet , Poem , can_delete = True , fields = '__all__' ) #NEWLINE# poet = Poet . objects . create ( name = 'test' ) #NEWLINE# poem = poet . poem_set . create ( name = 'test poem' ) #NEWLINE# data = { #NEWLINE# #INDENT# 'poem_set-TOTAL_FORMS' : '1' , #NEWLINE# 'poem_set-INITIAL_FORMS' : '1' , #NEWLINE# 'poem_set-MAX_NUM_FORMS' : '0' , #NEWLINE# 'poem_set-0-id' : str ( poet . pk ) , #NEWLINE# 'poem_set-0-poet' : str ( poet . pk ) , #NEWLINE# 'poem_set-0-name' : 'test' , #NEWLINE# 'poem_set-0-DELETE' : 'on' , #NEWLINE# #UNINDENT# } #NEWLINE# formset = PoemFormSet ( data , instance = poet ) #NEWLINE# formset . save ( ) #NEWLINE# self . assertTrue ( formset . is_valid ( ) ) #NEWLINE# self . assertEqual ( Poem . objects . count ( ) , 0 )