Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.1.X] Tweaked the model_formsets test to work around a weird sortin…

…g problem between versions of Postgres. Thanks to Alex Gaynor for the report.

Backport of r11953 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@11954 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit d0ea8f2d4cd8a43b174aa8ea75bf511503d09ea9 1 parent d65af73
@freakboy3742 freakboy3742 authored
Showing with 9 additions and 9 deletions.
  1. +9 −9 tests/modeltests/model_formsets/models.py
View
18 tests/modeltests/model_formsets/models.py
@@ -512,7 +512,7 @@ def __unicode__(self):
... '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 @@ def __unicode__(self):
True
>>> formset.save()
-[<Book: Le Spleen de Paris>]
+[<Book: Les Paradis Artificiels>]
-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 @@ def __unicode__(self):
... '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 @@ def __unicode__(self):
>>> 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]
-[<Book: Les Fleurs du Mal>, <Book: Le Spleen de Paris>]
+[<Book: Les Fleurs du Mal>, <Book: Les Paradis Artificiels>]
Test using a custom prefix on an inline formset.
@@ -650,8 +650,8 @@ def __unicode__(self):
>>> formset = AuthorBooksFormSet(instance=author, queryset=custom_qs)
>>> for form in formset.forms:
... print form.as_p()
-<p><label for="id_book_set-0-title">Title:</label> <input id="id_book_set-0-title" type="text" name="book_set-0-title" value="Les Fleurs du Mal" maxlength="100" /><input type="hidden" name="book_set-0-author" value="1" id="id_book_set-0-author" /><input type="hidden" name="book_set-0-id" value="1" id="id_book_set-0-id" /></p>
-<p><label for="id_book_set-1-title">Title:</label> <input id="id_book_set-1-title" type="text" name="book_set-1-title" value="Le Spleen de Paris" maxlength="100" /><input type="hidden" name="book_set-1-author" value="1" id="id_book_set-1-author" /><input type="hidden" name="book_set-1-id" value="2" id="id_book_set-1-id" /></p>
+<p><label for="id_book_set-0-title">Title:</label> <input id="id_book_set-0-title" type="text" name="book_set-0-title" value="Les Paradis Artificiels" maxlength="100" /><input type="hidden" name="book_set-0-author" value="1" id="id_book_set-0-author" /><input type="hidden" name="book_set-0-id" value="2" id="id_book_set-0-id" /></p>
+<p><label for="id_book_set-1-title">Title:</label> <input id="id_book_set-1-title" type="text" name="book_set-1-title" value="Les Fleurs du Mal" maxlength="100" /><input type="hidden" name="book_set-1-author" value="1" id="id_book_set-1-author" /><input type="hidden" name="book_set-1-id" value="1" id="id_book_set-1-id" /></p>
<p><label for="id_book_set-2-title">Title:</label> <input id="id_book_set-2-title" type="text" name="book_set-2-title" value="Flowers of Evil" maxlength="100" /><input type="hidden" name="book_set-2-author" value="1" id="id_book_set-2-author" /><input type="hidden" name="book_set-2-id" value="5" id="id_book_set-2-id" /></p>
<p><label for="id_book_set-3-title">Title:</label> <input id="id_book_set-3-title" type="text" name="book_set-3-title" maxlength="100" /><input type="hidden" name="book_set-3-author" value="1" id="id_book_set-3-author" /><input type="hidden" name="book_set-3-id" id="id_book_set-3-id" /></p>
<p><label for="id_book_set-4-title">Title:</label> <input id="id_book_set-4-title" type="text" name="book_set-4-title" maxlength="100" /><input type="hidden" name="book_set-4-author" value="1" id="id_book_set-4-author" /><input type="hidden" name="book_set-4-id" id="id_book_set-4-id" /></p>
@@ -662,7 +662,7 @@ def __unicode__(self):
... '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',

0 comments on commit d0ea8f2

Please sign in to comment.
Something went wrong with that request. Please try again.