mirror of https://github.com/django/django.git
Refs #22654 -- Added additional tests and amended release note.
This commit is contained in:
parent
d66378a8b2
commit
504e7782fe
|
@ -163,10 +163,6 @@ Forms
|
||||||
HTML attributes for the ``DateInput`` and ``TimeInput`` (or hidden)
|
HTML attributes for the ``DateInput`` and ``TimeInput`` (or hidden)
|
||||||
subwidgets.
|
subwidgets.
|
||||||
|
|
||||||
* :class:`~django.forms.FloatField` and :class:`~django.forms.DecimalField`
|
|
||||||
now handle :setting:`DECIMAL_SEPARATOR` and :setting:`THOUSAND_SEPARATOR`
|
|
||||||
correctly when :setting:`USE_L10N` is off.
|
|
||||||
|
|
||||||
Generic Views
|
Generic Views
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -311,6 +307,18 @@ Miscellaneous
|
||||||
* :class:`~django.views.generic.base.RedirectView` no longer silences
|
* :class:`~django.views.generic.base.RedirectView` no longer silences
|
||||||
``NoReverseMatch`` if the ``pattern_name`` doesn't exist.
|
``NoReverseMatch`` if the ``pattern_name`` doesn't exist.
|
||||||
|
|
||||||
|
* When :setting:`USE_L10N` is off, :class:`~django.forms.FloatField` and
|
||||||
|
:class:`~django.forms.DecimalField` now respect :setting:`DECIMAL_SEPARATOR`
|
||||||
|
and :setting:`THOUSAND_SEPARATOR` during validation. For example, with the
|
||||||
|
settings::
|
||||||
|
|
||||||
|
USE_L10N = False
|
||||||
|
USE_THOUSAND_SEPARATOR = True
|
||||||
|
DECIMAL_SEPARATOR = ','
|
||||||
|
THOUSAND_SEPARATOR = '.'
|
||||||
|
|
||||||
|
an input of ``"1.345"`` is now converted to ``1345`` instead of ``1.345``.
|
||||||
|
|
||||||
.. _deprecated-features-2.0:
|
.. _deprecated-features-2.0:
|
||||||
|
|
||||||
Features deprecated in 2.0
|
Features deprecated in 2.0
|
||||||
|
|
|
@ -874,6 +874,19 @@ class FormattingTests(SimpleTestCase):
|
||||||
# Suspicion that user entered dot as decimal separator (#22171)
|
# Suspicion that user entered dot as decimal separator (#22171)
|
||||||
self.assertEqual(sanitize_separators('10.10'), '10.10')
|
self.assertEqual(sanitize_separators('10.10'), '10.10')
|
||||||
|
|
||||||
|
with self.settings(USE_L10N=False, DECIMAL_SEPARATOR=','):
|
||||||
|
self.assertEqual(sanitize_separators('1001,10'), '1001.10')
|
||||||
|
self.assertEqual(sanitize_separators('1001.10'), '1001.10')
|
||||||
|
|
||||||
|
with self.settings(
|
||||||
|
USE_L10N=False, DECIMAL_SEPARATOR=',', USE_THOUSAND_SEPARATOR=True,
|
||||||
|
THOUSAND_SEPARATOR='.'
|
||||||
|
):
|
||||||
|
self.assertEqual(sanitize_separators('1.001,10'), '1001.10')
|
||||||
|
self.assertEqual(sanitize_separators('1001,10'), '1001.10')
|
||||||
|
self.assertEqual(sanitize_separators('1001.10'), '1001.10')
|
||||||
|
self.assertEqual(sanitize_separators('1,001.10'), '1.001.10') # Invalid output
|
||||||
|
|
||||||
def test_iter_format_modules(self):
|
def test_iter_format_modules(self):
|
||||||
"""
|
"""
|
||||||
Tests the iter_format_modules function.
|
Tests the iter_format_modules function.
|
||||||
|
|
Loading…
Reference in New Issue