mirror of
https://github.com/django/django.git
synced 2025-11-01 04:17:59 +00:00
Fixed #5903 -- DecimalField.get_default() now correctly returns a Decimal object when the model instance was not retrieved from the database. Thanks Justin Driscoll and pigletto.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9823 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
e9af96de1e
commit
e5cd43e588
3 changed files with 20 additions and 3 deletions
|
|
@ -20,6 +20,10 @@ Traceback (most recent call last):
|
|||
...
|
||||
ValidationError: This value must be a decimal number.
|
||||
|
||||
>>> f = DecimalField(default=Decimal("0.00"))
|
||||
>>> f.get_default()
|
||||
Decimal("0.00")
|
||||
|
||||
>>> f = DecimalField(max_digits=5, decimal_places=1)
|
||||
>>> x = f.to_python(2)
|
||||
>>> y = f.to_python('2.6')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue