From d9568af974b8ec1443a6d8c1f440e1514e39d9e8 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Tue, 22 Dec 2009 15:54:34 +0000 Subject: [PATCH] Tweaked the model_formsets test to work around a weird sorting problem between versions of Postgres. Thanks to Alex Gaynor for the report. git-svn-id: http://code.djangoproject.com/svn/django/trunk@11953 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/modeltests/model_formsets/models.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/modeltests/model_formsets/models.py b/tests/modeltests/model_formsets/models.py index 5c62885be5..1644ddf37b 100644 --- a/tests/modeltests/model_formsets/models.py +++ b/tests/modeltests/model_formsets/models.py @@ -512,7 +512,7 @@ book. ... 'book_set-INITIAL_FORMS': '1', # the number of forms with initial data ... 'book_set-0-id': '1', ... 'book_set-0-title': 'Les Fleurs du Mal', -... 'book_set-1-title': 'Le Spleen de Paris', +... 'book_set-1-title': 'Les Paradis Artificiels', ... 'book_set-2-title': '', ... } @@ -521,14 +521,14 @@ book. True >>> formset.save() -[] +[] -As you can see, 'Le Spleen de Paris' is now a book belonging to Charles Baudelaire. +As you can see, 'Les Paradis Artificiels' is now a book belonging to Charles Baudelaire. >>> for book in author.book_set.order_by('id'): ... print book.title Les Fleurs du Mal -Le Spleen de Paris +Les Paradis Artificiels The save_as_new parameter lets you re-associate the data to a new instance. This is used in the admin for save_as functionality. @@ -539,7 +539,7 @@ This is used in the admin for save_as functionality. ... 'book_set-0-id': '1', ... 'book_set-0-title': 'Les Fleurs du Mal', ... 'book_set-1-id': '2', -... 'book_set-1-title': 'Le Spleen de Paris', +... 'book_set-1-title': 'Les Paradis Artificiels', ... 'book_set-2-title': '', ... } @@ -550,7 +550,7 @@ True >>> new_author = Author.objects.create(name='Charles Baudelaire') >>> formset = AuthorBooksFormSet(data, instance=new_author, save_as_new=True) >>> [book for book in formset.save() if book.author.pk == new_author.pk] -[, ] +[, ] Test using a custom prefix on an inline formset. @@ -650,8 +650,8 @@ We can provide a custom queryset to our InlineFormSet: >>> formset = AuthorBooksFormSet(instance=author, queryset=custom_qs) >>> for form in formset.forms: ... print form.as_p() -

-

+

+

@@ -662,7 +662,7 @@ We can provide a custom queryset to our InlineFormSet: ... 'book_set-0-id': '1', ... 'book_set-0-title': 'Les Fleurs du Mal', ... 'book_set-1-id': '2', -... 'book_set-1-title': 'Le Spleen de Paris', +... 'book_set-1-title': 'Les Paradis Artificiels', ... 'book_set-2-id': '5', ... 'book_set-2-title': 'Flowers of Evil', ... 'book_set-3-title': 'Revue des deux mondes',