Ejemplo n.º 1
0
def employerAddInt():

    try:
        if escape(session['type']) == 'employer':
            if request.method == 'POST':
                #use the logged in uname(email) and position name
                #to create position in db module
                iid = adb.add_internship(session['uname'], request.form['posname'])
                txtfile = request.files['txt_file']
                if txtfile and allowed_text(txtfile.filename):
                    fname = "desc{}.{}".format(iid, "txt")
                    txtfile.save(os.path.join(app.config['UPLOAD_FOLDER'],
                                              fname))
                    flash("Successfully added your internship!")
                    return redirect('/Employer/Home')

                else:
                    flash("Could not add description file")
                    return redirect('/Employer/Home')

            return render_template('employeraddinternships.html')

    except:
        pass

    return redirect('/Employers')
Ejemplo n.º 2
0
def c_add_internship():
    iname = input("Internship name :")
    company = input("Company name :")
    i_year = int(input("Conducted year :"))
    db.add_internship(iname, company, i_year)