I'm trying to convert the total sum to a percentage by userid but an error pops up when I try to run the following program.
The error is:
name 'mark' is not defined
Below is my code for views.py
def attStudName(request):
students = MarkAtt.objects.values('studName__VMSAcc').annotate(mark=Sum('attendance'), percentage=(F('mark')/1100) *100)context = {'students' : students,}context = {'students' : students,'ttl' : ttl}return render(request,'show-name.html',context)
Managed to get the value out but it returned all zero. Here is my data:
Student Name| Attendance Mark | Percentage
anni | 800 | 0
benny | 800 | 0