summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2011-05-07 16:58:45 +0000
committerJannis Leidel <jannis@leidel.info>2011-05-07 16:58:45 +0000
commit0322f2b6533852b51d83ac4d55f11d75cc0f41b0 (patch)
tree2d9764785c3fdb9e3723bea8ccf8030abd4d5485 /tests
parent032b4ab5dfc39b8166d472ae5e360f985afe2988 (diff)
Fixed #15263 -- Added support for format localization to the now template tag. Thanks to danielr and dmclain.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16172 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/i18n/tests.py1
-rw-r--r--tests/regressiontests/templates/tests.py3
2 files changed, 4 insertions, 0 deletions
diff --git a/tests/regressiontests/i18n/tests.py b/tests/regressiontests/i18n/tests.py
index bedc2fea75..e3add3e3d8 100644
--- a/tests/regressiontests/i18n/tests.py
+++ b/tests/regressiontests/i18n/tests.py
@@ -305,6 +305,7 @@ class FormattingTests(TestCase):
self.assertEqual(u'10:15:48', Template('{{ t|time:"TIME_FORMAT" }}').render(self.ctxt))
self.assertEqual(u'31/12/2009', Template('{{ d|date:"SHORT_DATE_FORMAT" }}').render(self.ctxt))
self.assertEqual(u'31/12/2009 20:50', Template('{{ dt|date:"SHORT_DATETIME_FORMAT" }}').render(self.ctxt))
+ self.assertEqual(date_format(datetime.datetime.now(), "DATE_FORMAT"), Template('{% now "DATE_FORMAT" %}').render(self.ctxt))
form4 = I18nForm({
'decimal_field': u'66666,666',
diff --git a/tests/regressiontests/templates/tests.py b/tests/regressiontests/templates/tests.py
index 75f3b4f412..abfdb8d735 100644
--- a/tests/regressiontests/templates/tests.py
+++ b/tests/regressiontests/templates/tests.py
@@ -21,6 +21,7 @@ from django.template.loaders import app_directories, filesystem, cached
from django.test.utils import get_warnings_state, restore_warnings_state,\
setup_test_template_loader, restore_template_loaders
from django.utils import unittest
+from django.utils.formats import date_format
from django.utils.translation import activate, deactivate, ugettext as _
from django.utils.safestring import mark_safe
from django.utils.tzinfo import LocalTimezone
@@ -1422,6 +1423,8 @@ class Templates(unittest.TestCase):
'now02': ('{% now "j "n" Y"%}', {}, template.TemplateSyntaxError),
# 'now03': ('{% now "j \"n\" Y"%}', {}, str(datetime.now().day) + '"' + str(datetime.now().month) + '"' + str(datetime.now().year)),
# 'now04': ('{% now "j \nn\n Y"%}', {}, str(datetime.now().day) + '\n' + str(datetime.now().month) + '\n' + str(datetime.now().year))
+ # Check parsing of locale strings
+ 'now05': ('{% now "DATE_FORMAT" %}', {}, date_format(datetime.now())),
### URL TAG ########################################################
# Successes