예제 #1
0
def studentsearch(request):
    if "emailid" in request.session:
        name = request.POST.get('name')
        dao = Student()
        dao1 = Faculty()
        dao2 = Course()
        row = dao.studentsearch(name)
        row1 = dao1.facultysearch(name)
        row2 = dao2.coursesearch(name)
        context = {'row': row}
        context1 = {'row1': row1}
        context2 = {'row2': row2}
        if dao.studentsearch(name):
            return render(request, 'Student/student_view_after_search.html',
                          context)
        elif dao1.facultysearch(name):
            return render(request,
                          'Student/facultystudent_view_after_search.html',
                          context1)
        elif dao2.coursesearch(name):
            return render(request,
                          'Student/coursestudent_view_after_search.html',
                          context2)
        else:
            return render(request, 'Student/students_dashboard.html')
    else:
        return redirect('index-page')
예제 #2
0
def studentv(request):
    if "emailid" in request.session:
        dao = Student()
        row = dao.studentview()
        context = {'row': row}
        return render(request, 'Student/sviewstudent.html', context)
    else:
        return redirect('index-page')
예제 #3
0
def addl(request):
    emailid = request.session['emailid']
    start_date = request.POST.get('start')
    end_date = request.POST.get('end')
    reason = request.POST.get('reason')
    dao = Student()
    if dao.addleave(emailid, start_date, end_date, reason) > 0:
        return redirect('sviewleave')
예제 #4
0
def applyleave(request):
    if "emailid" in request.session:
        emailid = request.session['emailid']
        dao = Student()
        row = dao.viewsleavebysession(emailid)
        context = {'row': row}
        return render(request, 'Student/sleave.html', context)
    else:
        return redirect('index-page')
예제 #5
0
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, 'Student/sviewleave.html', context)
        else:
            return render(request, 'Student/students_dashboard.html')
    else:
        return redirect('index-page')