Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #3252 -- Fixed bugs in model_forms unit tests, related to recen…

…t newforms clean_data change. Thanks for the patch, mir@noris.de

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4294 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 0421b2597f35e421245c689ac8f1c7f1a455dd6b 1 parent 3b4d6b4
@adrianholovaty adrianholovaty authored
Showing with 9 additions and 6 deletions.
  1. +9 −6 tests/modeltests/model_forms/models.py
View
15 tests/modeltests/model_forms/models.py
@@ -67,8 +67,8 @@ def __str__(self):
<li>The URL: <input type="text" name="url" maxlength="40" /></li>
>>> f = CategoryForm({'name': 'Entertainment', 'url': 'entertainment'})
->>> f.errors
-{}
+>>> f.is_valid()
+True
>>> f.clean_data
{'url': u'entertainment', 'name': u'Entertainment'}
>>> obj = f.create()
@@ -78,8 +78,8 @@ def __str__(self):
[<Category: Entertainment>]
>>> f = CategoryForm({'name': "It's a test", 'url': 'test'})
->>> f.errors
-{}
+>>> f.is_valid()
+True
>>> f.clean_data
{'url': u'test', 'name': u"It's a test"}
>>> obj = f.create()
@@ -91,8 +91,8 @@ def __str__(self):
If you call create() with save=False, then it will return an object that hasn't
yet been saved. In this case, it's up to you to save it.
>>> f = CategoryForm({'name': 'Third test', 'url': 'third'})
->>> f.errors
-{}
+>>> f.is_valid()
+True
>>> f.clean_data
{'url': u'third', 'name': u'Third test'}
>>> obj = f.create(save=False)
@@ -109,6 +109,9 @@ def __str__(self):
>>> f.errors
{'name': [u'This field is required.']}
>>> f.clean_data
+Traceback (most recent call last):
+...
+AttributeError: 'CategoryForm' object has no attribute 'clean_data'
>>> f.create()
Traceback (most recent call last):
...
Please sign in to comment.
Something went wrong with that request. Please try again.