Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Simple voting for videos

  • Loading branch information...
commit 6d5fce9b1d1d7d2e411d25a61f546c034f047842 1 parent f45b33d
@georgevreilly authored
View
6 gae_flask_app/AdYouLation/handlers.py
@@ -25,9 +25,9 @@ def start():
return render_template("start.html", choices=choices, remaining=remaining)
class VoteForm(Form):
-# Video1Vote = RadioField(choices=("Yes!", "No!"))
-# Video2Vote = RadioField(choices=("Win!", "Lose!"))
- email = TextField('email address', [Required(), Email()])
+ CHOICES = (("UP", "Yes!"), ("down", "No!"))
+ video1Vote = RadioField("video #1", choices=CHOICES)
+ video2Vote = RadioField("video #2", choices=CHOICES)
@AdYouLation.route('/vote', methods=('GET', 'POST'))
def vote():
View
6 gae_flask_app/templates/forms/macros.html
@@ -10,3 +10,9 @@
{% endif %}
</div>
{% endmacro %}
+
+{% macro render_video(video) %}
+ <div class="video_field">
+ <h4>{{ video }}</h4>
+ </div>
+{% endmacro %}
View
11 gae_flask_app/templates/vote.html
@@ -1,12 +1,13 @@
{% extends "layout.html" %}
{% block body %}
<h1>Vote</h1>
- {% from "forms/macros.html" import render_field %}
+ {% from "forms/macros.html" import render_field, render_video %}
<form method="POST" action="." class="form">
- {{ video1 }}
- {{ render_field(form.email) }}
+ {{ render_video(video1) }}
+ {{ render_field(form.video1Vote) }}
<br/>
- {{ video2 }}
- <input type="submit" value="Login" class="button green">
+ {{ render_video(video2) }}
+ {{ render_field(form.video2Vote) }}
+ <input type="submit" value="Vote" class="button green">
</form>
{% endblock %}
Please sign in to comment.
Something went wrong with that request. Please try again.