>> if ((form.vars.drops * form.vars.price_change) / form.vars.start_price) < >> 0.20: >> TypeError: can't multiply sequence by non-int of type 'Decimal'
I think form.vars.drops is a string. I usually do something like Decimal(form.vars.somedecimalfield or 0) For the benefit of Python newcomers reading this thread... I learned the hard way you can't do arithmetic with None. I always set a default value for numeric fields. If the browser returns an empty value in a numeric field, Postgres sets the value to NULL. Again you can't do arithmetic with this value. So I force numeric values like this: db.mytable[myid].mynumeric or 0 request.vars.mynumeric or 0 (for handling javascript callbacks.) On Nov 27, 8:33 pm, pbreit <[email protected]> wrote: > I have some price fields specified as type 'decimal'. But am finding that I > have to cast to 'float' do do any math (or the other to decimal.Decimal I > guess). > > This seems cumbersome. Is 'decimal' the best field type for storing > financial amounts that will be involved in math calculations?

