models.py

class OurProducts(models.Model):
  code = models.CharField(max_length=60)
  rrp = models.DecimalField (max_digits=8, decimal_places=2)

  def __unicode__(self):
    return self.name

  def discount_amount(self):
    discount=0.65
    amount=self.rrp*discount
    return amount


My variable "discount" is float of 0.65, this wont multiply with "rrp"
decimalfield variable.  I can convert both discount and amount vars to
a FLOAT (no good for currency), but I cant seem to "from decimal
import Decimal" in order to define the 0.65 figure as a Decimal value.

What should I do?
Thanks for your help!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
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