/
Write
Start a team blog
NEW ✨
Start a team blog, invite your team, and start publishing.

How to get login time and logout time of multiple users/students using Django views?

NB's photo
NB
·Jul 25, 2019

So I have written a view for getting login time and logout time of a student. Now I want to perform the same procedure for n number of students so how should I do it? Please Help. Here's my code from views.py:

def timestamp(request):
    TodayStartdate = datetime.now().strftime("%Y-%m-%d")  + " 00:00"
    TodayEnddate = datetime.now().strftime("%Y-%m-%d")  + " 23:59"

    Timestamp = Attendance.objects.filter(reader_Timestamp__range= 
    (TodayStartdate, TodayEnddate))

    Login = Timestamp.first()
    Logout = Timestamp.last()

    print(Login)
    print(Logout)

    return render(request, 'app/timestamp.html')