mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #28915 -- Prevented SQLite from truncating trailing zeros in the fractional part of DecimalField.
This reverts commit a146b65628
and adds
a test for the regression.
This commit is contained in:
parent
30a389bd77
commit
6fd6d8383f
3 changed files with 12 additions and 6 deletions
|
@ -81,3 +81,9 @@ class DecimalFieldTests(TestCase):
|
|||
expected_message = validators.DecimalValidator.messages['max_whole_digits'] % {'max': 2}
|
||||
with self.assertRaisesMessage(ValidationError, expected_message):
|
||||
field.clean(Decimal('999'), None)
|
||||
|
||||
def test_roundtrip_with_trailing_zeros(self):
|
||||
"""Trailing zeros in the fractional part aren't truncated."""
|
||||
obj = Foo.objects.create(a='bar', d=Decimal('8.320'))
|
||||
obj.refresh_from_db()
|
||||
self.assertEqual(obj.d.compare_total(Decimal('8.320')), Decimal('0'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue