diff options
| author | Christopher Luc <chris.luc.dev@gmail.com> | 2015-03-21 17:45:42 -0700 |
|---|---|---|
| committer | Markus Holtermann <info@markusholtermann.eu> | 2015-03-29 23:38:51 +0200 |
| commit | c4e8f21a9c6f3dd8400f399bbaa0dc3295a8b9e8 (patch) | |
| tree | c3fce4a6ff66652ed5396b11041807c864510b25 /docs/ref | |
| parent | c0102dc7fff77555053b79c03205f6bfba64c156 (diff) | |
[1.8.x] Fixed #24281 -- Improved docs for timezone handling for auto_now and auto_now_add
Thanks djbug for the report and Aymeric Augustin and Carl Meyer for the
review.
Backport of 8119876d4a533fbc2ba4d1c30eaddbcc28119488 from master
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/models/fields.txt | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 716460d1b7..0804b8fbdd 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -510,6 +510,15 @@ Any combination of these options will result in an error. ``True`` will cause the field to have ``editable=False`` and ``blank=True`` set. +.. note:: + The ``auto_now`` and ``auto_now_add`` options will always use the date in + the :ref:`default timezone <default-current-time-zone>` at the moment of + creation or update. If you need something different, you may want to + consider simply using your own callable default or overriding ``save()`` + instead of using ``auto_now`` or ``auto_now_add``; or using a + ``DateTimeField`` instead of a ``DateField`` and deciding how to handle the + conversion from datetime to date at display time. + ``DateTimeField`` ----------------- |
