Ticket #5469: newforms_docs.diff

File newforms_docs.diff, 1.1 KB (added by Manuel Saelices, 17 years ago)

Documentation patch

  • docs/newforms.txt

     
    10521052displayed for unbound forms, and they're not used as fallback values if a
    10531053particular value isn't provided.
    10541054
     1055Note that ``initial`` values are *not* cleaned. It is supposed that values are right, unlike ``data`` values::
     1056
     1057    >>> class NewsForm(forms.Form):
     1058    ...     date = forms.DateField()
     1059    ...     title = forms.CharField()
     1060    >>> f = NewsForm(initial={'date': 'not_a_date'})
     1061    >>> f.as_table()
     1062    <tr><th><label for="id_date">Date:</label></th><td><input type="text" name="date" value="not_a_date" id="id_date" /></td></tr>
     1063    <tr><th><label for="id_title">Title:</label></th><td><input type="text" name="title" id="id_title" /></td></tr>
     1064
    10551065Finally, note that if a ``Field`` defines ``initial`` *and* you include
    10561066``initial`` when instantiating the ``Form``, then the latter ``initial`` will
    10571067have precedence. In this example, ``initial`` is provided both at the field
Back to Top