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'])
def employerDeleteInt(iid): if escape(session['type']) == 'employer': cid = adb.get_cid(escape(session['uname'])) if adb.check_ci_ids(cid, iid) and adb.int_isactive(iid): adb.int_makeinactive(iid) flash("Deleted your internship.") return redirect('/Employer/ViewInternships') return redirect('/Employer')