dimanche 31 juillet 2016

How to compare one employee to all employees salary in django model?

emp = Employee.objects.filter(id=1)

Persons =  Employee.objects.extra(select={'difference':(emp.values_list("Salary",flat=True)[0]-float('Salary'))})

But it give Error :

Exception Type: ValueError

Exception Value:could not convert string to float: 'Salary'.

How can i solve this Error.

Aucun commentaire:

Enregistrer un commentaire