From a9017a1e5ab1a4092a76545b91bc834891e85d9f Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Wed, 1 Apr 2009 00:08:34 +0000 Subject: [1.0.X] A whole lotta documentation fixes, backported from r10303 on trunk. I got my commit message cut off the first try, but luckily I get to still thank Kevin Kubasik for rolling all these fixes up into a single easy patch. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10306 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 b8b1a43bf6..c4c6458a81 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