def search(request):
    if "emailid" in request.session:
        name = request.POST.get('name')
        dao = Student()
        dao1 = Faculty()
        dao2 = Course()
        row = dao.searchstudent(name)
        row1 = dao1.searchfaculty(name)
        row2 = dao2.searchcourse(name)
        context = {'row': row}
        context1 = {'row1': row1}
        context2 = {'row2': row2}
        if dao.searchstudent(name):
            print(name)
            return render(request, 'schedules/view_after_search.html', context)
        elif dao1.searchfaculty(name):
            return render(request, 'schedules/f_view_after_search.html',
                          context1)
        elif dao2.searchcourse(name):
            return render(request, 'schedules/c_view_after_search.html',
                          context2)
        else:
            return render(request, 'schedules/Dashboard.html')
    else:
        return redirect('index-page')
def vstudent(request):
    if "emailid" in request.session:
        dao = Student()
        row = dao.viewstudent()
        context = {'row': row}
        return render(request, 'schedules/viewstudent.html', context)
    else:
        return redirect('index-page')
def addstudent(request):
    if "emailid" in request.session:
        dao = Student()
        lst1 = dao.selectcourse()
        context = {'lst1': lst1}
        return render(request, 'schedules/addstudent.html', context)
    else:
        return redirect('index-page')
def estudent(request):
    if "emailid" in request.session:
        sid = request.GET.get('sid')
        dao = Student()
        lst1 = dao.selectcourse()
        row = dao.viewstudentbyid(sid)
        context = {'lst1': lst1, 'row': row}
        return render(request, 'schedules/editstudent.html', context)
    else:
        return redirect('index-page')
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')
def Plannerform(request, c_code_selected=None):
    dao1 = Student()
    dao2 = Course()
    dao3 = Faculty()
    lst1 = dao1.selectcourse()
    lst2 = dao2.selectmodule(c_code_selected)
    lst3 = dao3.selectfaculty()
    context = {
        'c_code_selected': c_code_selected,
        'lst1': lst1,
        'lst2': lst2,
        'lst3': lst3
    }
    return render(request, 'schedules/session.html', context)
def deletestudent(request):
    if "emailid" in request.session:

        # sid = request.GET.get('sid')
        email = request.GET.get('email')
        dao = Student()
        lst1 = dao.deletestudent(email)
        print(lst1)
        context = {
            'lst1': lst1
            # 'deletestudent':"deletestudent"
        }
        if dao.deletestudent(email) > 0:
            return redirect('viewstudent')
    else:
        return redirect('index-page')
Exemple #10
0
def editstudent(request):
    if "emailid" in request.session:
        sid = request.POST.get('sid')
        f_name = request.POST.get('f_name')
        l_name = request.POST.get('l_name')
        emailid = request.POST.get('emailid')
        c_code = request.POST.get('c_code')

        dao = Student()
        lst1 = dao.selectcourse()
        row = dao.viewstudentbyid(sid)
        context = {'lst1': lst1, 'row': row, 'estudent': "estudent"}
        if dao.editstudent(f_name, l_name, emailid, c_code, sid) > 0:
            return redirect('viewstudent')
    else:
        return redirect('index-page')
Exemple #11
0
def add(request):
    if "emailid" in request.session:
        f_name = request.POST.get('f_name')
        l_name = request.POST.get('l_name')
        emailid = request.POST.get('emailid')
        password = request.POST.get('password')
        c_code = request.POST.get('c_code')
        dao = Student()
        lst1 = dao.selectcourse()
        context = {'lst1': lst1, 'addstudent': "addstudent"}
        if dao.add(f_name, l_name, emailid, password, c_code) > 0:
            return redirect('viewstudent')
        else:
            return redirect('dashboard')
    else:
        return redirect('index-page')