I take it that you are using python3.x rather than python2.x. In python 2.x, the expression 100/25 is the integer 4 In python 3.x, the expression 100/25 is 4.0 And as someone already pointed out mixing Decimal and float doesn't work.
Try replacing the 100 / 4 with one of int(100/4) or (100//4) (yes, two slashes does integer divide) or Decimal(str(100/4)), or try the original examples in a python2.x version where the single slash operator still returns an int if both arguments are int. Bill On Wed, Feb 3, 2010 at 1:12 PM, Chris McComas <mccomas.ch...@gmail.com> wrote: > This is kinda of a general and kind of a specific question. I have > this in my view: > > http://dpaste.com/154208/ > > The first line adds up perfectly, but the second one doesn't and > throws an index out of range error. > > What is the problem? > > cog.interview_score and cog.interview_score_conv are both > DecimalFields. > > -- > 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. > > -- 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.