From 8119876d4a533fbc2ba4d1c30eaddbcc28119488 Mon Sep 17 00:00:00 2001 From: Christopher Luc Date: Sat, 21 Mar 2015 17:45:42 -0700 Subject: 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. --- docs/ref/models/fields.txt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 3dd0e41e7a..01ff654353 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -505,6 +505,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 ` 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`` ----------------- -- cgit v1.3