Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit dce557b9e7ad41dce171167b3679c5c67fdbcde3 1 parent 3ce8106
Russell Keith-Magee freakboy3742 authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 docs/modelforms.txt
7 docs/modelforms.txt
View
@@ -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``.
Please sign in to comment.
Something went wrong with that request. Please try again.