diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-03-31 23:34:03 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2009-03-31 23:34:03 +0000 |
| commit | 516051bfd2b537f441c46359cce7eacbf15fc4b8 (patch) | |
| tree | c518cb5727dcbbdeec08bf849e94bdfa7b5e36a7 /docs/ref/forms | |
| parent | 15becf23a9e4c9b230745738d2d42f6ab8f0f031 (diff) | |
A whole lotta documentation fixes: Fixes #8704, #8826, #8980, #9243, #9343, #9529,
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10303 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref/forms')
| -rw-r--r-- | docs/ref/forms/fields.txt | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index 4248af3d26..d1ff54908d 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -174,6 +174,16 @@ validation if a particular field's value is not given. ``initial`` values are >>> f.errors {'url': [u'This field is required.'], 'name': [u'This field is required.']} +Instead of a constant, you can also pass any callable:: + + >>> import datetime + >>> class DateForm(forms.Form): + ... day = forms.DateField(initial=datetime.date.today) + >>> print DateForm() + <tr><th>Day:</th><td><input type="text" name="day" value="12/23/2008" /><td></tr> + +The callable will be evaluated only when the unbound form is displayed, not when it is defined. + ``widget`` ~~~~~~~~~~ |
