summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-12-17 05:12:53 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-12-17 05:12:53 +0000
commita0ef6f691551b3f1bf5db6535488c36e01da9819 (patch)
tree732f01ec38e7f53fd9a74d861b5beb4f2ae7dc7f /tests
parente76e2aaffb407086544b015a81c33e6e5bb3558f (diff)
newforms: Added optional 'form' parameter to form_for_model
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/modeltests/model_forms/models.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/modeltests/model_forms/models.py b/tests/modeltests/model_forms/models.py
index f86382abc4..5ffd6aac9f 100644
--- a/tests/modeltests/model_forms/models.py
+++ b/tests/modeltests/model_forms/models.py
@@ -29,7 +29,7 @@ class Article(models.Model):
return self.headline
__test__ = {'API_TESTS': """
->>> from django.newforms import form_for_model
+>>> from django.newforms import form_for_model, BaseForm
>>> Category.objects.all()
[]
@@ -101,4 +101,13 @@ Traceback (most recent call last):
...
ValueError: The Category could not be created because the data didn't validate.
+You can pass a custom Form class to form_for_model. Make sure it's a
+subclass of BaseForm, not Form.
+>>> class CustomForm(BaseForm):
+... def say_hello(self):
+... print 'hello'
+>>> CategoryForm = form_for_model(Category, form=CustomForm)
+>>> f = CategoryForm()
+>>> f.say_hello()
+hello
"""}