Commit 866d7fa9 authored by James Bennett's avatar James Bennett
Browse files

Correct an example in docs/modelforms.txt, and fix some reST formatting


git-svn-id: http://code.djangoproject.com/svn/django/trunk@7222 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent 42712048
Loading
Loading
Loading
Loading
+24 −24
Original line number Diff line number Diff line
@@ -226,7 +226,7 @@ For example::

    # Create a form instance with POST data.
    >>> a = Author()
    >>> f = AuthorForm(a, request.POST)
    >>> f = AuthorForm(request.POST, instance=a)

    # Create and save the new author instance. There's no need to do anything else.
    >>> new_author = f.save()
@@ -242,17 +242,17 @@ model fields:
   created from the model via ``ModelForm`` will not include that
   field.

    2. Use the ``fields`` attribute of the ``ModelForm``'s inner ``Meta`` class.
       This attribute, if given, should be a list of field names to include in
       the form.
2. Use the ``fields`` attribute of the ``ModelForm``'s inner ``Meta``
   class.  This attribute, if given, should be a list of field names
   to include in the form.

    3. Use the ``exclude`` attribute of the ``ModelForm``'s inner ``Meta`` class.
       This attribute, if given, should be a list of field names to exclude
       the form.
3. Use the ``exclude`` attribute of the ``ModelForm``'s inner ``Meta``
   class.  This attribute, if given, should be a list of field names
   to exclude the form.

       For example, if you want a form for the ``Author`` model (defined above)
       that includes only the ``name`` and ``title`` fields, you would specify
       ``fields`` or  ``exclude`` like this::
For example, if you want a form for the ``Author`` model (defined
above) that includes only the ``name`` and ``title`` fields, you would
specify ``fields`` or ``exclude`` like this::

    class PartialAuthorForm(ModelForm):
        class Meta: