summaryrefslogtreecommitdiff
path: root/docs/ref/models
diff options
context:
space:
mode:
authorBulgantamir Gankhuyag <mr.unagaldai@gmail.com>2015-11-24 21:17:10 +0800
committerTim Graham <timograham@gmail.com>2015-11-24 08:40:14 -0500
commit92d0d2cb1bf7fe68d966f7b383cdf0a4c44a0ba1 (patch)
tree37945d9f6d8a2a06d0432bb6147530f794174264 /docs/ref/models
parent954d63155f92d92c5fa33c30be2869a2592830ef (diff)
[1.8.x] Clarified default value for DateField to emulate auto_now_add.
Backport of 8bce6fa637952342278c59d06520611e3ba80cbb from master
Diffstat (limited to 'docs/ref/models')
-rw-r--r--docs/ref/models/fields.txt8
1 files changed, 6 insertions, 2 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index cc82d0fde3..51e4b0de18 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -497,9 +497,13 @@ optional arguments:
for creation of timestamps. Note that the current date is *always* used;
it's not just a default value that you can override. So even if you
set a value for this field when creating the object, it will be ignored.
- If you want to be able to modify this field, set ``default=timezone.now``
- (from :func:`django.utils.timezone.now`) instead of ``auto_now_add=True``.
+ If you want to be able to modify this field, set the following instead of
+ ``auto_now_add=True``:
+ * For :class:`DateField`: ``default=date.today`` - from
+ :meth:`datetime.date.today`
+ * For :class:`DateTimeField`: ``default=timezone.now`` - from
+ :func:`django.utils.timezone.now`
The default form widget for this field is a
:class:`~django.forms.TextInput`. The admin adds a JavaScript calendar,