1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

[1.0.X] Fixed #5079 -- Avoid converting Decimals to floats during save to the database.

[9394] from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9395 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Karen Tracey
2008-11-12 00:38:48 +00:00
parent 11736980a4
commit 2a1c9072fb
2 changed files with 16 additions and 2 deletions

View File

@@ -32,6 +32,9 @@ class Whiz(models.Model):
(0,'Other'),
)
c = models.IntegerField(choices=CHOICES, null=True)
class BigD(models.Model):
d = models.DecimalField(max_digits=38, decimal_places=30)
__test__ = {'API_TESTS':"""
# Create a couple of Places.
@@ -78,5 +81,11 @@ u''
>>> Foo.objects.filter(d=u'1.23')
[]
# Regression test for #5079 -- ensure decimals don't go through a corrupting
# float conversion during save.
>>> bd = BigD(d="12.9")
>>> bd.save()
>>> bd = BigD.objects.get(pk=bd.pk)
>>> bd.d == decimal.Decimal("12.9")
True
"""}