﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
4486	Newforms DecimalField formats initial data improperly	anonymous	Adrian Holovaty	"OK, I'm a bit new to this, so hopefully I""m getting this right...

DecimalField fields seem to misformat ""initial"" data in most cases.  All of the below tests should output 

{{{ 
<input type=""text"" name=""f"" value=""25.00"" id=""id_f"" /> 
}}}

except for testForm2 (not sure what the correct behavior should be) and testForm4 (which should output the following):

{{{ 
<input type=""text"" name=""f"" value=""25.01"" id=""id_f"" /> 
}}}

Testcases:

{{{
#!python>>> from django import newforms as forms
>>> 
>>> class testForm(forms.Form):
...      f = forms.DecimalField(max_digits=8, decimal_places=2, initial=25.00)
... 
>>> t = testForm()
>>> print t['f']
<input type=""text"" name=""f"" value=""25.0"" id=""id_f"" />
>>> 
>>> 
>>> class testForm2(forms.Form):
...      f = forms.DecimalField(max_digits=8, decimal_places=2, initial=25.001)
... 
>>> t = testForm2()
>>> print t['f']
<input type=""text"" name=""f"" value=""25.001"" id=""id_f"" />
>>> 
>>> 
>>> class testForm3(forms.Form):
...      f = forms.DecimalField(max_digits=8, decimal_places=2, initial=25)
... 
>>> t = testForm3()
>>> print t['f']
<input type=""text"" name=""f"" value=""25"" id=""id_f"" />
>>> 
>>> 
>>> class testForm4(forms.Form):
...      f = forms.DecimalField(max_digits=8, decimal_places=2, initial=25.01)
... 
>>> t = testForm4()
>>> print t['f']
<input type=""text"" name=""f"" value=""25.01"" id=""id_f"" />
>>> 
>>> 
>>> class testForm5(forms.Form):
...      f = forms.DecimalField(max_digits=8, decimal_places=2, initial=25.000)
... 
>>> t = testForm5()
>>> print t['f']
<input type=""text"" name=""f"" value=""25.0"" id=""id_f"" />
}}}"		closed	Forms	dev		invalid			Unreviewed	0	0	0	0	0	0
