[Answer]-How to make equations in views.py with a model field (beginner)

1πŸ‘

βœ…

I don’t understand if you already have the total price or the price without VAT to begin with. If I understand, you want to calculate the total cost by doing importe_sin_iva * 1.21

extra_context['importe_iva_incluida'] = fact.importe_sin_iva * 1.21

If you want to have the VAT to display in your template, just do

extra_context['iva'] = fact.importe_sin_iva * 0.21
πŸ‘€Steve K

Leave a comment