Ticket #8160: test_model_formsets.diff

File test_model_formsets.diff, 757 bytes (added by justinf, 7 years ago)

changes the save_as_new test so the new patch passes it

  • tests/modeltests/model_formsets/models.py

     
    368368...     'book_set-2-title': '',
    369369... }
    370370
    371 >>> formset = AuthorBooksFormSet(data, instance=Author(), save_as_new=True)
    372 >>> formset.is_valid()
    373 True
    374371
    375372>>> 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()
     375True
    377376>>> [book for book in formset.save() if book.author.pk == new_author.pk]
    378377[<Book: Les Fleurs du Mal>, <Book: Le Spleen de Paris>]
    379378
Back to Top