If anyone down the road ends up looking for a solution to this, I worked it 
out via StackOverflow:

http://stackoverflow.com/questions/13163167/how-to-get-a-django-admin-form-field-for-a-models-decimalfield-with-value-0-to-n/13210775#13210775

On Wednesday, October 31, 2012 12:37:26 PM UTC-6, Ben Roberts wrote:
>
> I created a ticket <https://code.djangoproject.com/ticket/19220#ticket>for 
> this, since it really doesn't seem right for a Decimal field to be 
> using E notation in forms, but just for zeros.
>
> We use django admin as a client-facing backend, so we need to make it user 
> friendly. I have a model with a bunch of DecimalFields representing 
> nutritional data.
>
> The fields all look like this:
>
> g_carbs = DecimalField(max_digits=13, decimal_places = 8, null=True, 
> blank=True) 
>
> If the field is left blank, or if a non-zero value is provided, the admin 
> form looks and works great. For example, for a non-blank, non-zero value 
> like 10.5, it displays something like 10.50000000, which is fine.
>
> The problem is that for any 0 values, the form field displays 0E-8 which, 
> although technically correct, is not going to cut it for clients, who are 
> not scientists or engineers for the most part and are unfamiliar with E 
> notation. We're using DecimalFields rather than FloatFields to avoid this 
> type of notation.
>
> I am not using a custom ModelForm or any custom admin tricks. Its just 
> what gets auto-rendered by django admin for that model. 
>
> I'm wondering if there is a work-around to this problem in the mean time.  
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/V_mnJiQhgnoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to