def sviewleave(request):  #for viewing leaves (tables)
    if "emailid" in request.session:
        dao = Student()
        row = dao.viewleave()
        context = {'row': row}
        if dao.viewleave():
            return render(request, 'schedules/studentleave.html', context)
        else:
            return redirect('dashboard')
    else:
        return redirect('index-page')
def rejects(request):
    if "emailid" in request.session:
        l_id = request.GET.get('l_id')
        dao = Student()
        a = dao.rejectstudent('l_id')
        print(a)
        row = dao.viewleave()
        context = {'a': a, 'row': row}
        if dao.rejectstudent(l_id) > 0:
            return render(request, 'schedules/studentleave.html', context)
    else:
        return redirect('index-page')
def rejectsleave(request):
    if "emailid" in request.session:
        l_id = request.POST.get('l_id')
        print("l_id1:", l_id)
        dao = Student()
        a = dao.rejectstudent(l_id)
        print("a1:", a)
        row = dao.viewleave()
        context = {'a': a, 'row': row}
        if dao.rejectstudent() > 0:
            print("def")
            return redirect('studentleave')
    else:
        return redirect('index-page')