Ticket #8160: test_model_formsets.diff
File test_model_formsets.diff, 757 bytes (added by , 16 years ago) |
---|
-
tests/modeltests/model_formsets/models.py
368 368 ... 'book_set-2-title': '', 369 369 ... } 370 370 371 >>> formset = AuthorBooksFormSet(data, instance=Author(), save_as_new=True)372 >>> formset.is_valid()373 True374 371 375 372 >>> new_author = Author.objects.create(name='Charles Baudelaire') 376 >>> formset.instance = new_author 373 >>> formset = AuthorBooksFormSet(data, instance=new_author, save_as_new=True) 374 >>> formset.is_valid() 375 True 377 376 >>> [book for book in formset.save() if book.author.pk == new_author.pk] 378 377 [<Book: Les Fleurs du Mal>, <Book: Le Spleen de Paris>] 379 378