Example #1
0
def studentResume():
    if escape(session['type']) == 'student':
        if request.method == 'GET':
            sid = adb.get_sid(escape(session['uname']))
            if get_txtfile(sid):
                #txtfile = open(get_txtfile(sid))
                return render_template('studenteditresume.html', sid=sid, ext=get_txtext(get_txtfile(sid)))
            else:
                return render_template('studentaddresume.html')


        if request.method == 'POST':
            #use the logged in uname(email) and position name
            #to create position in db module
            sid = adb.get_sid(escape(session['uname']))
            txtfile = request.files['txt_file']
            if txtfile and allowed_text(txtfile.filename):
                fname = "resume{}.{}".format(sid, get_txtext(txtfile.filename))
                txtfile.save(os.path.join(app.config['UPLOAD_FOLDER'],
                                          fname))
                flash("Successfully added your resume!")
                return redirect('/Student/Home')

            else:
                flash("Could not add your resume")
                return redirect('/Student/Home')

    return redirect('/Student')
Example #2
0
def studentViewApps():
    if escape(session['type']) == 'student':
        email = escape(session['uname']) #email of logged in student

        sid = adb.get_sid(escape(session['uname']))
        jobs = adb.get_jobs(sid)

        table=[(i[0], i[4], i[5], i[6],
                os.path.isfile(os.path.join(app.config['UPLOAD_FOLDER'],
                               "desc{}.txt".format(i[6]))),
                is_imgfile(i[2]), i[2]) for i in jobs if i[8]]

        return render_template('studentview.html', table=table)

    return redirect('/Student')
Example #3
0
def studentApply(iid):
    if escape(session['type']) == 'student':
        email = escape(session['uname']) #email of logged in student
        if adb.int_isactive(iid) and adb.apply_student(email, iid): #if success, (hasn't already applied)
            sid = adb.get_sid(email)
            toemail = adb.get_cemail(iid)
            send_email(sid, iid, toemail, email)
            flash('You have successfully applied to this internship!')
            return redirect("/Student/Search")

        elif not adb.int_isactive(iid):
            flash('Could not apply to this internship.')
            return redirect("/Student/Search")
        else: #student has already applied
            flash('You have already applied to this internship!', 'error')
            return redirect("/Student/Search")

    return escape(session['type'])