diff options
| author | Brian Rosner <brosner@gmail.com> | 2008-06-23 21:05:02 +0000 |
|---|---|---|
| committer | Brian Rosner <brosner@gmail.com> | 2008-06-23 21:05:02 +0000 |
| commit | 420f19aa353ee6568c93f34dfe2e6eef24bc528d (patch) | |
| tree | 12f182ec4f958ac08a57f05786fdbefabae9910c /docs/modelforms.txt | |
| parent | c929440fcd001b97b805f2229fb85deae3f86e05 (diff) | |
newforms-admin: Merged from trunk up to [7729].
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7730 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/modelforms.txt')
| -rw-r--r-- | docs/modelforms.txt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/modelforms.txt b/docs/modelforms.txt index fae860944e..5cff11fdeb 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``. |
