summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2011-12-04 22:11:12 +0000
committerAymeric Augustin <aymeric.augustin@m4x.org>2011-12-04 22:11:12 +0000
commit33bb3cd47cb287daa1246b705eff0f55bf72d284 (patch)
tree9b97d5c8dd37e868bf9ad2479245cc04de717cce /django
parente42360b56b8a215e5752b42b63fa5f2a0b2e78fd (diff)
Fixed #17343 -- Changed the {% now %} tag to use the current time zone when time zone support is enabled. Thanks oinopion for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17169 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r--django/template/defaulttags.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
index 9620d1cb81..a1a3f5f70c 100644
--- a/django/template/defaulttags.py
+++ b/django/template/defaulttags.py
@@ -15,6 +15,7 @@ from django.template.smartif import IfParser, Literal
from django.template.defaultfilters import date
from django.utils.encoding import smart_str, smart_unicode
from django.utils.safestring import mark_safe
+from django.utils import timezone
register = Library()
@@ -343,7 +344,8 @@ class NowNode(Node):
self.format_string = format_string
def render(self, context):
- return date(datetime.now(), self.format_string)
+ tzinfo = timezone.get_current_timezone() if settings.USE_TZ else None
+ return date(datetime.now(tz=tzinfo), self.format_string)
class SpacelessNode(Node):
def __init__(self, nodelist):