Saturday, February 26, 2011

Re: foreign key reference in the 'def' to calculate tax


> class TaxReference(models.Model):
> tax_multiplier = models.DecimalField()

> class Product(models.Model):
> price = models.DecimalField(max_digits=10, decimal_places=2)
> tax = models.ForeignKey(TaxReference)
> def taxedprice(self):
> return self.price*TaxReference.tax_multiplier
> The very last line of code is what I'm trying to accomplish.

Is this what you want?

def taxedprice(self):
return self.price *


Pascal Germroth

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment