Hello I am trying to create an employee attendance program and I want to make it so that the employees can see the total hours they worked.
This is the code that creating the problem:
elif 'checkName' in response.POST: if form.is_valid(): n = form.cleaned_data["name"] t = Name.objects.filter(name=n) totalHours = datetime.combine(t.date, t.timeOut) - datetime.combine(t.date, t.timeIn) messages.success(response, totalHours) return redirect('/')
The error I get is
'QuerySet' object has no attribute 'date'
and if I use
t = Name.objects.get(name=n)
it shows an error that says
'get() returned more than one Name -- it returned 2!'