Skip to content
Advertisement

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:

JavaScript

The error I get is

JavaScript

and if I use

JavaScript

it shows an error that says

JavaScript

Advertisement

Answer

You must use filter and iterate over results as get is used to fetch exactly one record. Try this:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement