summaryrefslogtreecommitdiff
path: root/tests/modeltests/model_forms
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2007-09-15 22:25:52 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2007-09-15 22:25:52 +0000
commit019e3c61e4390b0e5ad981256d6426e24083626a (patch)
tree5efefabcad63dbe68f0c2b53c4ff5100667fc24d /tests/modeltests/model_forms
parentb2669113821eeb8b3cd654bbf5ab33053894b923 (diff)
newforms-admin: Merged to [6332].
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@6342 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/modeltests/model_forms')
-rw-r--r--tests/modeltests/model_forms/models.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/modeltests/model_forms/models.py b/tests/modeltests/model_forms/models.py
index 47407573dd..bc14c117d5 100644
--- a/tests/modeltests/model_forms/models.py
+++ b/tests/modeltests/model_forms/models.py
@@ -115,7 +115,7 @@ True
>>> obj = f.save()
>>> obj
<Category: It's a test>
->>> Category.objects.all()
+>>> Category.objects.order_by('name')
[<Category: Entertainment>, <Category: It's a test>]
If you call save() with commit=False, then it will return an object that
@@ -129,10 +129,10 @@ True
>>> obj = f.save(commit=False)
>>> obj
<Category: Third test>
->>> Category.objects.all()
+>>> Category.objects.order_by('name')
[<Category: Entertainment>, <Category: It's a test>]
>>> obj.save()
->>> Category.objects.all()
+>>> Category.objects.order_by('name')
[<Category: Entertainment>, <Category: It's a test>, <Category: Third test>]
If you call save() with invalid data, you'll get a ValueError.
@@ -306,7 +306,7 @@ Add some categories and test the many-to-many form output.
>>> new_art.id
1
>>> new_art = Article.objects.get(id=1)
->>> new_art.categories.all()
+>>> new_art.categories.order_by('name')
[<Category: Entertainment>, <Category: It's a test>]
Now, submit form data with no categories. This deletes the existing categories.
@@ -327,7 +327,7 @@ Create a new article, with categories, via the form.
>>> new_art.id
2
>>> new_art = Article.objects.get(id=2)
->>> new_art.categories.all()
+>>> new_art.categories.order_by('name')
[<Category: Entertainment>, <Category: It's a test>]
Create a new article, with no categories, via the form.
@@ -348,7 +348,7 @@ The m2m data won't be saved until save_m2m() is invoked on the form.
... 'writer': u'1', 'article': u'Test.', 'categories': [u'1', u'2']})
>>> new_art = f.save(commit=False)
-# Manually save the instance
+# Manually save the instance
>>> new_art.save()
>>> new_art.id
4
@@ -360,7 +360,7 @@ The m2m data won't be saved until save_m2m() is invoked on the form.
# Save the m2m data on the form
>>> f.save_m2m()
->>> new_art.categories.all()
+>>> new_art.categories.order_by('name')
[<Category: Entertainment>, <Category: It's a test>]
Here, we define a custom Form. Because it happens to have the same fields as