diff options
| author | Bulgantamir Gankhuyag <mr.unagaldai@gmail.com> | 2015-11-24 21:17:10 +0800 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-11-24 08:38:14 -0500 |
| commit | 8bce6fa637952342278c59d06520611e3ba80cbb (patch) | |
| tree | 89621adebc5d3c044f977308a738ddcda5104b46 /docs | |
| parent | bb50c7da7c8f2c324a464a028a216ec0247896e3 (diff) | |
Clarified default value for DateField to emulate auto_now_add.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/fields.txt | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 4ec3a67fd7..3dcbc99f4c 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -491,9 +491,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, |
