Django: Ticket #2660: FloatField cant be edited in admin.https://code.djangoproject.com/ticket/2660
<p>
When adding the following FloatField to a model:
score = models.FloatField(blank=True,null=True,max_digits=1,decimal_places=1)
And setting it to for example 5.5, in the admin panel it will show as "5.". And if you try to save it it will complain with "Please enter a valid decimal number with a whole part of at most 0 digits."
</p>
<p>
I've checked the value, and it does store correctly, so the bug is in the admin panel.
</p>
en-usDjangohttps://www.djangoproject.com/s/img/site/hdr_logo.gifhttps://code.djangoproject.com/ticket/2660
Trac 1.2James BennettWed, 06 Sep 2006 15:19:39 GMTstatus changed; resolution sethttps://code.djangoproject.com/ticket/2660#comment:1
https://code.djangoproject.com/ticket/2660#comment:1
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>invalid</em>
</li>
</ul>
<p>
You have a bad combination of arguments there; <code>max_digits=1</code> means "do not accept numbers with more than one total digit in them", which means that <code>decimal_places</code> can't do much for you -- as soon as you enter the "5" you've got one total digit and <code>max_digits</code> won't let you enter any more. If you need to store a number of the form "5.5", you need <code>max_digits=2, decimal_places=1</code>.
</p>
Ticket