empname = Leave.objects.filter(created_by=self.request.user)[0].emp_id_requested_for
typelist = TypeAssign.objects.filter(emp_id__emp_name=empname)
output = {}
data = Leave.objects.filter(created_by=self.request.user)
for x in data:
output[x.leave_type_id] = [0,0]
for t in data:
output[t.leave_type_id][0] = (t.total_approve_leave + output[t.leave_type_id][0])
for x in typelist:
**output[LeaveType.objects.get(type_name=x)][1] = LeaveType.objects.get(type_name=x).max_duration**
ctx["output"] = output
return ctx
質問する
44 次