How do I get multiple rows from django database?

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.timeOut) - datetime.combine(, 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!'

Read more here:

Content Attribution

This content was originally published by DIN at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: