mirror of
https://github.com/django/django.git
synced 2025-07-23 05:05:17 +00:00
Made django.utils.timezone.localtime a private API -- it's too specific to the template engine.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17642 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
c988397279
commit
7ce1ad7c03
2 changed files with 7 additions and 7 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue