I have the following model:
class MyClass(models.model):
usuario = models.Charfield(max_length=45)
saldo_ini=models.DecimalField(decimal_places=1,max_digits=10, null=True)
saldo_fin=models.DecimalField(decimal_places=1,max_digits=10, null=True)
In a view I want to get the usuario
and the subtraction of saldo_fin - saldo_ini
using a queryset. How I do this?
I tried this:
MyClass.objects.values('usuario').annotate(resta=float('saldo_fin') - float('saldo_ini'))