Skip to content
Browse files

Fixed #6891 -- Clarified modelform usage documentation. Thanks to Eri…

…c Holscher for the suggestion.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7728 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 3ce8106 commit dce557b9e7ad41dce171167b3679c5c67fdbcde3 @freakboy3742 freakboy3742 committed
Showing with 7 additions and 0 deletions.
  1. +7 −0 docs/modelforms.txt
View
7 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``.

0 comments on commit dce557b

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