i want to calculate multiplication of amount
and percent
field:
class Info_data(models.Model):
name = models.CharField(blank=True, max_length=100)
amount = models.DecimalField(max_digits=5, decimal_places=0)
percent = models.ForeignKey(Owner, related_name="percentage")
then write this property:
def _get_total(self):
return self.percent * self.amount
total = property(_get_total)
and use in template:
{% for list_calculated in list_calculateds %}
<ul>
<li>{{list_calculated.name}}</li>
<li>{{list_calculated.total}}</li>
</ul>
{% endfor %}
but return blank. how to use property in template?