1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[1.7.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 8119876d4a from master
This commit is contained in:
Christopher Luc
2015-03-21 17:45:42 -07:00
committed by Markus Holtermann
parent 7c7d29adbe
commit 19ddf59b26
2 changed files with 11 additions and 2 deletions

View File

@@ -501,6 +501,15 @@ message key.
``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``
-----------------