diff options
| author | Karen Tracey <kmtracey@gmail.com> | 2008-11-12 00:35:24 +0000 |
|---|---|---|
| committer | Karen Tracey <kmtracey@gmail.com> | 2008-11-12 00:35:24 +0000 |
| commit | cb6a5886f6ccc0272288dba0f8b4c15a81100bf3 (patch) | |
| tree | fe2d63bb557c00d5a89ca682847f6bf16cc8a07d /tests/regressiontests/model_fields | |
| parent | 1142dd430fd3786904d1a1e9a761d873e4765f08 (diff) | |
Fixed #5079 -- Avoid converting Decimals to floats during save to the database.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9394 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/model_fields')
| -rw-r--r-- | tests/regressiontests/model_fields/models.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/regressiontests/model_fields/models.py b/tests/regressiontests/model_fields/models.py index 455e2b3ded..a1c2bb0bc8 100644 --- a/tests/regressiontests/model_fields/models.py +++ b/tests/regressiontests/model_fields/models.py @@ -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 """} |
