Skip to content

Commit 4916854

Browse files
committed
Removed USE_L10N setting from Django 4.0.
USE_L10N defaults to True from Django 4.0, and will be removed in Django 5.0.
1 parent 2d9eee5 commit 4916854

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ def pytest_addoption(parser):
1818
def pytest_configure(config):
1919
from django.conf import settings
2020

21+
# USE_L10N is deprecated, and will be removed in Django 5.0.
22+
use_l10n = {"USE_L10N": True} if django.VERSION < (4, 0) else {}
2123
settings.configure(
2224
DEBUG_PROPAGATE_EXCEPTIONS=True,
2325
DATABASES={
@@ -33,7 +35,6 @@ def pytest_configure(config):
3335
SITE_ID=1,
3436
SECRET_KEY='not very secret in tests',
3537
USE_I18N=True,
36-
USE_L10N=True,
3738
STATIC_URL='/static/',
3839
ROOT_URLCONF='tests.urls',
3940
TEMPLATES=[
@@ -68,6 +69,7 @@ def pytest_configure(config):
6869
PASSWORD_HASHERS=(
6970
'django.contrib.auth.hashers.MD5PasswordHasher',
7071
),
72+
**use_l10n,
7173
)
7274

7375
# guardian is optional

tests/test_fields.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,12 +1220,12 @@ class TestNoStringCoercionDecimalField(FieldValues):
12201220

12211221

12221222
class TestLocalizedDecimalField(TestCase):
1223-
@override_settings(USE_L10N=True, LANGUAGE_CODE='pl')
1223+
@override_settings(LANGUAGE_CODE='pl')
12241224
def test_to_internal_value(self):
12251225
field = serializers.DecimalField(max_digits=2, decimal_places=1, localize=True)
12261226
assert field.to_internal_value('1,1') == Decimal('1.1')
12271227

1228-
@override_settings(USE_L10N=True, LANGUAGE_CODE='pl')
1228+
@override_settings(LANGUAGE_CODE='pl')
12291229
def test_to_representation(self):
12301230
field = serializers.DecimalField(max_digits=2, decimal_places=1, localize=True)
12311231
assert field.to_representation(Decimal('1.1')) == '1,1'

0 commit comments

Comments
 (0)