Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Made django.utils.timezone.localtime a private API -- it's too specif…

…ic to the template engine.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 7ce1ad7c0364102523e4696a6926c099b7f0584e 1 parent c988397
Aymeric Augustin aaugustin authored
Showing with 7 additions and 7 deletions.
  1. +7 −2 django/utils/
  2. +0 −5 docs/ref/utils.txt
9 django/utils/
@@ -17,7 +17,7 @@
__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 @@ def __exit__(self, exc_type, exc_value, traceback):
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.
5 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 <default-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
Please sign in to comment.
Something went wrong with that request. Please try again.