mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
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.
This commit is contained in:
parent
2d9eee5d02
commit
4916854492
|
@ -18,6 +18,8 @@ def pytest_addoption(parser):
|
|||
def pytest_configure(config):
|
||||
from django.conf import settings
|
||||
|
||||
# USE_L10N is deprecated, and will be removed in Django 5.0.
|
||||
use_l10n = {"USE_L10N": True} if django.VERSION < (4, 0) else {}
|
||||
settings.configure(
|
||||
DEBUG_PROPAGATE_EXCEPTIONS=True,
|
||||
DATABASES={
|
||||
|
@ -33,7 +35,6 @@ def pytest_configure(config):
|
|||
SITE_ID=1,
|
||||
SECRET_KEY='not very secret in tests',
|
||||
USE_I18N=True,
|
||||
USE_L10N=True,
|
||||
STATIC_URL='/static/',
|
||||
ROOT_URLCONF='tests.urls',
|
||||
TEMPLATES=[
|
||||
|
@ -68,6 +69,7 @@ def pytest_configure(config):
|
|||
PASSWORD_HASHERS=(
|
||||
'django.contrib.auth.hashers.MD5PasswordHasher',
|
||||
),
|
||||
**use_l10n,
|
||||
)
|
||||
|
||||
# guardian is optional
|
||||
|
|
|
@ -1220,12 +1220,12 @@ class TestNoStringCoercionDecimalField(FieldValues):
|
|||
|
||||
|
||||
class TestLocalizedDecimalField(TestCase):
|
||||
@override_settings(USE_L10N=True, LANGUAGE_CODE='pl')
|
||||
@override_settings(LANGUAGE_CODE='pl')
|
||||
def test_to_internal_value(self):
|
||||
field = serializers.DecimalField(max_digits=2, decimal_places=1, localize=True)
|
||||
assert field.to_internal_value('1,1') == Decimal('1.1')
|
||||
|
||||
@override_settings(USE_L10N=True, LANGUAGE_CODE='pl')
|
||||
@override_settings(LANGUAGE_CODE='pl')
|
||||
def test_to_representation(self):
|
||||
field = serializers.DecimalField(max_digits=2, decimal_places=1, localize=True)
|
||||
assert field.to_representation(Decimal('1.1')) == '1,1'
|
||||
|
|
Loading…
Reference in New Issue
Block a user