1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Refs #32873 -- Removed settings.USE_L10N per deprecation timeline.

This commit is contained in:
Mariusz Felisiak
2023-01-06 14:46:33 +01:00
parent 0be8095b25
commit 8d98f99a4a
19 changed files with 136 additions and 573 deletions

View File

@@ -1,9 +1,7 @@
from datetime import datetime
from django.forms import CharField, DateTimeInput, Form
from django.test import ignore_warnings
from django.utils import translation
from django.utils.deprecation import RemovedInDjango50Warning
from .base import WidgetTest
@@ -65,39 +63,6 @@ class DateTimeInputTest(WidgetTest):
html=('<input type="text" name="date" value="17.09.2007 12:51:34">'),
)
@translation.override("de-at")
def test_locale_aware(self):
d = datetime(2007, 9, 17, 12, 51, 34, 482548)
# RemovedInDjango50Warning: When the deprecation ends, remove
# @ignore_warnings and USE_L10N=False. The assertion should remain
# because format-related settings will take precedence over
# locale-dictated formats.
with ignore_warnings(category=RemovedInDjango50Warning):
with self.settings(USE_L10N=False):
with self.settings(
DATETIME_INPUT_FORMATS=[
"%Y-%m-%d %H:%M:%S",
"%Y-%m-%d %H:%M:%S.%f",
"%Y-%m-%d %H:%M",
]
):
self.check_html(
self.widget,
"date",
d,
html=(
'<input type="text" name="date" '
'value="2007-09-17 12:51:34">'
),
)
with translation.override("es"):
self.check_html(
self.widget,
"date",
d,
html='<input type="text" name="date" value="17/09/2007 12:51:34">',
)
def test_fieldset(self):
class TestForm(Form):
template_name = "forms_tests/use_fieldset.html"