Commit dce557b9 authored by Russell Keith-Magee's avatar Russell Keith-Magee
Browse files

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
parent 3ce81068
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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``.