mirror of https://github.com/django/django.git
parent
81a453ca0f
commit
37fbeb99f9
|
@ -1544,12 +1544,6 @@ class DecimalField(Field):
|
|||
params={'value': value},
|
||||
)
|
||||
|
||||
def _format(self, value):
|
||||
if isinstance(value, str):
|
||||
return value
|
||||
else:
|
||||
return self.format_number(value)
|
||||
|
||||
def format_number(self, value):
|
||||
"""
|
||||
Format a number into a string with the requisite number of digits and
|
||||
|
|
|
@ -28,12 +28,6 @@ class DecimalFieldTests(TestCase):
|
|||
f = models.DecimalField(default=Decimal('0.00'))
|
||||
self.assertEqual(f.get_default(), Decimal('0.00'))
|
||||
|
||||
def test_format(self):
|
||||
f = models.DecimalField(max_digits=5, decimal_places=1)
|
||||
self.assertEqual(f._format(f.to_python(2)), '2.0')
|
||||
self.assertEqual(f._format(f.to_python('2.6')), '2.6')
|
||||
self.assertIsNone(f._format(None))
|
||||
|
||||
def test_get_prep_value(self):
|
||||
f = models.DecimalField(max_digits=5, decimal_places=1)
|
||||
self.assertIsNone(f.get_prep_value(None))
|
||||
|
|
Loading…
Reference in New Issue