Friday, 15 April 2011

python - Django Picklist Won't Take Decimal Value -



python - Django Picklist Won't Take Decimal Value -

i trying simple django app fill form decimal field pick-list. admin form displays (selecting right item list), submitting gives error:

'select valid choice. 1.046 not 1 of available choices.'

my model looks this:

gravity_choices = ( (1.041, '1.041'), (1.042, '1.042'), (1.043, '1.043'), (1.044, '1.044'), (1.045, '1.045'), (1.046, '1.046'), ) ... og = models.decimalfield(max_digits=4, decimal_places=3, choices=gravity_choices, null=true, blank=true)

it works fine when submit decimal value field simple text input field, pick list create things easier.

what missing?

not 100% if issue have single quotes wrapped around values right, might trying pass values strings instead of numbers. seek removing quotes.

python django decimal picklist

No comments:

Post a Comment