Skip to content

Commit

Permalink
Documented the 'commit' argument to save() methods on forms created v…
Browse files Browse the repository at this point in the history
…ia form_for_model() or form_for_instance()

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5691 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Jul 13, 2007
1 parent 193e6db commit 9fa91e0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/newforms.txt
Expand Up @@ -1495,6 +1495,13 @@ example::
Note that ``save()`` will raise a ``ValueError`` if the data in the form
doesn't validate -- i.e., ``if form.errors``.

This ``save()`` method accepts an optional ``commit`` keyword argument, which
accepts either ``True`` or ``False``. If you call ``save()`` with
``commit=False``, then it will return an object that hasn't yet been saved to
the database. In this case, it's up to you to call ``save()`` on the resulting
model instance. This is useful if you want to do custom processing on the
object before saving it. ``commit`` is ``True`` by default.

Using an alternate base class
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit 9fa91e0

Please sign in to comment.