summaryrefslogtreecommitdiff
path: root/docs/ref/forms
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2009-04-01 00:08:34 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2009-04-01 00:08:34 +0000
commita9017a1e5ab1a4092a76545b91bc834891e85d9f (patch)
tree9821ff658057f3b1e8c965298280a7cf250a2aab /docs/ref/forms
parent97b22bde3c4ef46867b0190e462110f1c542e7e8 (diff)
[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
Diffstat (limited to 'docs/ref/forms')
-rw-r--r--docs/ref/forms/fields.txt10
1 files changed, 10 insertions, 0 deletions
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()
+ <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``
~~~~~~~~~~