diff --git a/django/utils/timezone.py b/django/utils/timezone.py index 676f8f18afe..9d706c96a94 100644 --- a/django/utils/timezone.py +++ b/django/utils/timezone.py @@ -17,7 +17,7 @@ from django.conf import settings __all__ = [ 'utc', 'get_default_timezone', 'get_current_timezone', 'activate', 'deactivate', 'override', - 'localtime', 'is_naive', 'is_aware', 'make_aware', 'make_naive', + 'is_naive', 'is_aware', 'make_aware', 'make_naive', ] @@ -204,7 +204,7 @@ class override(object): del _active.value -# Utilities +# Templates def localtime(value, use_tz=None): """ @@ -212,6 +212,8 @@ def localtime(value, use_tz=None): If use_tz is provided and is not None, that will force the value to be converted (or not), overriding the value of settings.USE_TZ. + + This function is designed for use by the template engine. """ if (isinstance(value, datetime) and (settings.USE_TZ if use_tz is None else use_tz) @@ -224,6 +226,9 @@ def localtime(value, use_tz=None): value = timezone.normalize(value) return value + +# Utilities + def now(): """ Returns an aware or naive datetime.datetime, depending on settings.USE_TZ. diff --git a/docs/ref/utils.txt b/docs/ref/utils.txt index c7b8e1bec4a..a4fdf7dd48c 100644 --- a/docs/ref/utils.txt +++ b/docs/ref/utils.txt @@ -666,11 +666,6 @@ For a complete discussion on the usage of the following see the ``None``, the :ref:`current time zone ` is unset on entry with :func:`deactivate()` instead. -.. function:: localtime(value, use_tz=None) - - This function is used by the template engine to convert datetimes to local - time where appropriate. - .. function:: now() Returns an aware or naive :class:`~datetime.datetime` that represents the