Chris McComas wrote:
I tried this, but no luck:

new_green.hp_coursepoints = Decimal(new_green.hp_grade) *
hp_credithours

Decimal can't directly convert floats to decimals.

Try:

new_green.hp_coursepoints = Decimal(str(new_green.hp_grade)) * hp_credithours

or

new_green.hp_coursepoints = Decimal("%.2f" % new_green.hp_grade) * hp_credithours

if you prefer to round hp_grade to a fixed number of decimals before doing the math.

Javier.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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