示例#1
0
def show_common_investments():

    #get company names from form
    vc1 = request.args.get("vc1")
    vc2 = request.args.get("vc2")

    #query database for path
    vc1_object = dbsession.query(VCList).filter_by(name=vc1).first()
    vc1_path = vc1_object.permalink.encode("utf8")

    vc2_object = dbsession.query(VCList).filter_by(name=vc2).first()
    vc2_path = vc2_object.permalink.encode("utf8")

    #use path to call the functions that return the common investments list
    vc = class_objects.CompareVcs(vc1_path, vc2_path)
    common_investments_list = list(vc.compare_investments())

    return render_template("common_investments.html",
                           common_investments_list=common_investments_list)
示例#2
0
def show_common_investments():
	
	#get company names from form
	vc1 = request.args.get("vc1")
	vc2 = request.args.get("vc2")
	
	#query database for path
	vc1_object = dbsession.query(VCList).filter_by(name = vc1).first()
	vc1_path = vc1_object.permalink.encode("utf8")
	
	vc2_object = dbsession.query(VCList).filter_by(name = vc2).first()
	vc2_path = vc2_object.permalink.encode("utf8")
	
	#use path to call the functions that return the common investments list
	vc = class_objects.CompareVcs(vc1_path, vc2_path)
	common_investments_list = list(vc.compare_investments())

	return render_template("common_investments.html",
						common_investments_list=common_investments_list)
示例#3
0
def process_login():
	
	user_email = request.form.get('user-email')
	password = request.form.get('user-password')
	
	user = dbsession.query(User).filter_by(email=user_email).first()
	
	if user and user.check_password(password):
		session["user"] = user.email
		return redirect("/vc-list") 
	
	else:
		print "at else"
		return redirect("/")
示例#4
0
def process_login():

    user_email = request.form.get('user-email')
    password = request.form.get('user-password')

    user = dbsession.query(User).filter_by(email=user_email).first()

    if user and user.check_password(password):
        session["user"] = user.email
        return redirect("/vc-list")

    else:
        print "at else"
        return redirect("/")
示例#5
0
def show_company_data():
	
	pc_name = request.args.get("company")

	#get company name
	pc = dbsession.query(PortfolioCompany).filter_by(company_name = pc_name).first()

	date_string = pc.founded.strftime("%B %d, %Y")
	 
	return render_template("company_data.html",
							description=pc.description,
							founded=date_string,
							homepage_url=pc.homepage_url,
							city=pc.city,
							state=pc.state,
							total_funding=format_currency(pc.total_funding))
示例#6
0
def show_company_data():

    pc_name = request.args.get("company")

    #get company name
    pc = dbsession.query(PortfolioCompany).filter_by(
        company_name=pc_name).first()

    date_string = pc.founded.strftime("%B %d, %Y")

    return render_template("company_data.html",
                           description=pc.description,
                           founded=date_string,
                           homepage_url=pc.homepage_url,
                           city=pc.city,
                           state=pc.state,
                           total_funding=format_currency(pc.total_funding))
示例#7
0
def process_new_user():

    first_name = request.form.get('first-name')
    last_name = request.form.get('last-name')
    user_email = request.form.get('new-user-email')
    password = request.form.get('new-user-password')
    user = User(first_name=first_name,
                last_name=last_name,
                email=user_email,
                password=password)

    user.set_password(password)

    if dbsession.query(User).filter_by(email=user_email).first():

        return redirect('/')

    else:
        dbsession.add(user)
    dbsession.commit()
    session["user"] = user.email
    return redirect("/vc-list")
示例#8
0
def process_new_user():
	
	first_name = request.form.get('first-name')
	last_name = request.form.get('last-name')
	user_email = request.form.get('new-user-email')
	password = request.form.get('new-user-password')
	user = User(
		first_name = first_name,
		last_name = last_name,
		email = user_email,
		password=password
		)
	
	user.set_password(password)

	if dbsession.query(User).filter_by(email = user_email).first():
		
		return redirect('/')
	
	else:
		dbsession.add(user)
    	dbsession.commit()
    	session["user"] = user.email
    	return redirect("/vc-list")