Hi all am stuck at getting total_price Calculated in my model

class inventory(models.Model):
    def __str__(self):
        return self.name

    category = models.ForeignKey(Category, null=True, on_delete = 
models.SET_NULL)
    Supplier = models.ForeignKey(Supplier, null=True, on_delete = 
models.SET_NULL)
    product = models.ForeignKey(Product, null=True, on_delete = models.SET_NULL)
    quantity = models.FloatField()
    unit_price = models.FloatField()
    total_price = models.FloatField(total=('unit_price' * 'quantity'))
    selling_price = models.FloatField()
    date_created = models.DateTimeField(auto_now_add=True) 


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/4ab25477-99fa-4de4-a774-667d336235e6n%40googlegroups.com.

Reply via email to