summaryrefslogtreecommitdiff
path: root/tests/regressiontests/model_fields/tests.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-06-30 10:07:06 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-06-30 10:07:06 +0000
commit52cc11c4e24be0a108d3f778ed546985fc608535 (patch)
tree2062b4cace45adeb9634ab17343fe62da9b3e7c0 /tests/regressiontests/model_fields/tests.py
parenta254f125ffa0246549728403a28b01656766965e (diff)
Fixed #4485 -- Allow nullable DecimalFields to store NULLs.
Based on a patch from tdterry. Thanks. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7797 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/model_fields/tests.py')
-rw-r--r--tests/regressiontests/model_fields/tests.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/regressiontests/model_fields/tests.py b/tests/regressiontests/model_fields/tests.py
index e279a0669f..c2ba9ee008 100644
--- a/tests/regressiontests/model_fields/tests.py
+++ b/tests/regressiontests/model_fields/tests.py
@@ -15,4 +15,21 @@ Decimal("3.14")
Traceback (most recent call last):
...
ValidationError: [u'This value must be a decimal number.']
+
+>>> f = DecimalField(max_digits=5, decimal_places=1)
+>>> x = f.to_python(2)
+>>> y = f.to_python('2.6')
+
+>>> f.get_db_prep_save(x)
+u'2.0'
+>>> f.get_db_prep_save(y)
+u'2.6'
+>>> f.get_db_prep_save(None)
+>>> f.get_db_prep_lookup('exact', x)
+[u'2.0']
+>>> f.get_db_prep_lookup('exact', y)
+[u'2.6']
+>>> f.get_db_prep_lookup('exact', None)
+[None]
+
"""