Ticket #9906: 9906.diff

File 9906.diff, 738 bytes (added by Beat Bolli, 16 years ago)

Documentation patch

  • docs/ref/forms/fields.txt

     
    173173    >>> f.errors
    174174    {'url': [u'This field is required.'], 'name': [u'This field is required.']}
    175175
     176Instead of a constant, you can also pass any callable::
     177
     178    >>> import datetime
     179    >>> class DateForm(forms.Form):
     180    ...     day = forms.DateField(initial=datetime.date.today)
     181    >>> print DateForm()
     182    <tr><th>Day:</th><td><input type="text" name="day" value="12/23/2008" /><td></tr>
     183
     184The callable will be evaluted only when the unbound form is displayed, not when it is defined.
     185
    176186``widget``
    177187~~~~~~~~~~
    178188
Back to Top