Re: Decimal * Float problem

2011-05-11 Thread Ian Clelland
On Wed, May 11, 2011 at 1:14 AM, Colin Corbett wrote: > Thanks! Solved: > > In models.py: > > class OurProducts(models.Model): > code = models.CharField(max_length=60) > name = models.CharField(max_length=80) > price = models.DecimalField (max_digits=8, decimal_places=2) > > def combined_pric

Re: Decimal * Float problem

2011-05-11 Thread Colin Corbett
Thanks! Solved: In models.py: class OurProducts(models.Model): code = models.CharField(max_length=60) name = models.CharField(max_length=80) price = models.DecimalField (max_digits=8, decimal_places=2) def combined_price(self): from decimal import Decimal return round(self.price

Re: Decimal * Float problem

2011-05-10 Thread Shawn Milochik
What error do you get? You should be able to import Decimal then do: discount = Decimal('0.65') -- 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,

Decimal * Float problem

2011-05-10 Thread Colin Corbett
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 variab