Create a function at class level like this.. *class xxx(models.Model):* quantity = models.FloatField() unit_price = models.FloatField()
* def get_total_price(self):* return self.quantity * self.unit_price On Saturday, September 19, 2020 at 11:15:30 AM UTC-4 eankomah wrote: > I have two fields: > quantity = models.FloatField() > unit_price = models.FloatField() > > and i want ot do someting like this > > > total_price = models.FloatField('unit_price' * 'quantity') > > Thanks > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/daa1a5d0-1266-49fa-a453-ceaa5f7785fcn%40googlegroups.com.