def cats_route(id):
    cat = get_cat_by_id(id)
    if request.method == "GET":
        return render_template('cat.html', cat=cat)
    else:
        add_vote(cat.id)
        return render_template('cat.html', cat=cat)
def catbook_profile(id):
    if request.method == 'GET':
        cat = get_cat_id(id)
        return render_template("cat.html", n=cat)
    else:
        add_vote(id)
        cats = get_all_cats()
        return render_template("home.html", cats=cats)
def catbook_cat_info(id):
    if request.method == 'GET':
        cat = get_cat_by_id(id)
        return render_template("cat.html", cat=cat)
    else:
        add_vote(id)
        cat = get_cat_by_id(id)
        return render_template("cat.html", cat=cat)
Exemple #4
0
def submit():
    if request.method == "GET":
        return render_template('submitted.html')
    else:
        if request.form["voterIdBox"] == "":
            return render_template('missingInfo.html')
        if request.form["candidates"] is None:
            return render_template('missingInfo.html')
        if database.vote_already_submitted(
                request.form['voterIdBox']) == "yes":
            return render_template('alreadyVoted.html')
        print("please use another device next")
        if database.check_if_not_lace_machine(
                request.environ['REMOTE_ADDR']) == "no":
            return render_template('useAnotherDevice.html')
        voterId = request.form["voterIdBox"]
        print("validating voterId next")
        if validateVoterId(voterId) == "invalid":
            return render_template('missingInfo.html')
        ipAddress = request.environ['REMOTE_ADDR']
        choice = request.form["candidates"]
        database.add_vote(voterId, ipAddress, choice)
        return render_template('submitted.html')
Exemple #5
0
def vote_planet():
    planet_id = request.form["planetid"]
    planet_name = request.form["planetname"]
    user_id = request.form["userid"]
    database.add_vote(planet_id, planet_name, user_id)
    return ""
Exemple #6
0
def add_votes(id):
	add_vote(id)
	return redirect("/")