From 516051bfd2b537f441c46359cce7eacbf15fc4b8 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Tue, 31 Mar 2009 23:34:03 +0000 Subject: 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 --- docs/ref/forms/fields.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs/ref/forms') 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() + Day: + +The callable will be evaluated only when the unbound form is displayed, not when it is defined. + ``widget`` ~~~~~~~~~~ -- cgit v1.3