summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2008-06-23 12:57:11 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2008-06-23 12:57:11 +0000
commitdce557b9e7ad41dce171167b3679c5c67fdbcde3 (patch)
tree935d12a6219eb55251b667e87750f9e017da5c7f /docs
parent3ce81068b842c3bcc98146de081fc52527cf9ad3 (diff)
Fixed #6891 -- Clarified modelform usage documentation. Thanks to Eric Holscher for the suggestion.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7728 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/modelforms.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/modelforms.txt b/docs/modelforms.txt
index a76d797527..73335a03a2 100644
--- a/docs/modelforms.txt
+++ b/docs/modelforms.txt
@@ -182,6 +182,13 @@ supplied, ``save()`` will update that instance. If it's not supplied,
# Create a form to edit an existing Article.
>>> a = Article.objects.get(pk=1)
>>> f = ArticleForm(instance=a)
+ >>> f.save()
+
+ # Create a form to edit an existing Article, but use
+ # POST data to populate the form.
+ >>> a = Article.objects.get(pk=1)
+ >>> f = ArticleForm(request.POST, instance=a)
+ >>> f.save()
Note that ``save()`` will raise a ``ValueError`` if the data in the form
doesn't validate -- i.e., ``if form.errors``.