def addAjax(): crusher = session['user'] cyear = request.args.get('cyear',"") lyear = request.args.get('lyear',"") crush = request.args.get('ccrush',"") hm = request.args.get('chm','') print cyear print lyear if len(crush)>0: mongo.addPerson2(str(crusher),crush,cyear,lyear,hm) crushl = mongo.getPeopleYouLike2(str(crusher)) return render_template("crushonly.html",name=False,crush=True,crushlist=crushl,person=crusher)
def addAjax(): crusher = session['user'] cyear = request.args.get('cyear', "") lyear = request.args.get('lyear', "") crush = request.args.get('ccrush', "") hm = request.args.get('chm', '') print cyear print lyear if len(crush) > 0: mongo.addPerson2(str(crusher), crush, cyear, lyear, hm) crushl = mongo.getPeopleYouLike2(str(crusher)) return render_template("crushonly.html", name=False, crush=True, crushlist=crushl, person=crusher)
def add(): if request.method == "POST": username = "" password = "" current = "" name = "" if 'username' in request.form: username = request.form.get("username") password = request.form.get("password") name = mongo.getName2(username,password) session['user'] = name crushlist = "" if name == 0: return render_template("add.html",name=True,crush=False,crushlist="") crushl = mongo.getPeopleYouLike2(str(name)) return render_template("add.html",name=False,crush=True,crushlist=crushl,person=name,current=current) elif 'usernamereg' in request.form: namereg = request.form.get("namereg") usernamereg = request.form.get("usernamereg") passwordreg1 = request.form.get("passwordreg1") passwordreg2 = request.form.get("passwordreg2") crushlist = "" current = "" if passwordreg1 != passwordreg2: return render_template("add.html",name=True,crush=False,crushlist="") mongo.addUser(namereg,usernamereg,passwordreg1) session['user'] = namereg crushlist = mongo.getPeopleYouLike2(str(namereg)) return render_template("add.html",name=False,crush=True,crushlist=crushlist,person=namereg,current=current) elif 'remove' in request.form: name = session['user'] mongo.removeUser(name) return render_template("add.html",name=True,crush=False,crushlist="") elif 'add' in request.form: meep = request.form.get("crushes") crushl = [x.strip() for x in meep.split('\n')] name = session['user'] for item in crushl: item.strip() x = item.split(", ") print x print len(x) if len(x)>2: mongo.addPerson2(str(name),x[0],x[1],x[2]) elif len(x) == 1: continue else: mongo.addPerson2(str(name),x[0],x[1],"") crushl = mongo.getPeopleYouLike2(str(name)) return render_template("add.html",name=False,crush=True,crushlist=crushl,person=name,current=meep) else: name = session['user'] print request.form crush = request.form.keys()[0] print crush mongo.removeCrush(name,crush) crushl = mongo.getPeopleYouLike2(str(name)) return render_template("add.html",name=False,crush=True,crushlist=crushl,person=name) return render_template("add.html",name=True,crush=False,crushlist="")
def add(): if request.method == "POST": username = "" password = "" current = "" name = "" if 'username' in request.form: username = request.form.get("username") password = request.form.get("password") name = mongo.getName2(username, password) session['user'] = name crushlist = "" if name == 0: return render_template("add.html", name=True, crush=False, crushlist="") crushl = mongo.getPeopleYouLike2(str(name)) return render_template("add.html", name=False, crush=True, crushlist=crushl, person=name, current=current) elif 'usernamereg' in request.form: namereg = request.form.get("namereg") usernamereg = request.form.get("usernamereg") passwordreg1 = request.form.get("passwordreg1") passwordreg2 = request.form.get("passwordreg2") crushlist = "" current = "" if passwordreg1 != passwordreg2: return render_template("add.html", name=True, crush=False, crushlist="") mongo.addUser(namereg, usernamereg, passwordreg1) session['user'] = namereg crushlist = mongo.getPeopleYouLike2(str(namereg)) return render_template("add.html", name=False, crush=True, crushlist=crushlist, person=namereg, current=current) elif 'remove' in request.form: name = session['user'] mongo.removeUser(name) return render_template("add.html", name=True, crush=False, crushlist="") elif 'add' in request.form: meep = request.form.get("crushes") crushl = [x.strip() for x in meep.split('\n')] name = session['user'] for item in crushl: item.strip() x = item.split(", ") print x print len(x) if len(x) > 2: mongo.addPerson2(str(name), x[0], x[1], x[2]) elif len(x) == 1: continue else: mongo.addPerson2(str(name), x[0], x[1], "") crushl = mongo.getPeopleYouLike2(str(name)) return render_template("add.html", name=False, crush=True, crushlist=crushl, person=name, current=meep) else: name = session['user'] print request.form crush = request.form.keys()[0] print crush mongo.removeCrush(name, crush) crushl = mongo.getPeopleYouLike2(str(name)) return render_template("add.html", name=False, crush=True, crushlist=crushl, person=name) return render_template("add.html", name=True, crush=False, crushlist="")