mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
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
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user