Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Show Leaderboard

  • Loading branch information...
commit 21d723a4319341a3d546fdfba6fd409f6a700d22 1 parent a48e12d
@georgevreilly authored
View
9 gae_flask_app/AdYouLation/handlers.py
@@ -8,7 +8,7 @@
import logging
import uuid
-class Video(db.Model):
+class VideoVotes(db.Model):
name = db.StringProperty(required = True)
up_votes = db.IntegerProperty(required = True)
down_votes = db.IntegerProperty(required = True)
@@ -18,10 +18,15 @@ def reset_votes():
videos = current_app.videos["videos"]
results = []
for video in videos:
- model = Video(name=video, up_votes=0, down_votes=0)
+ model = VideoVotes(name=video, up_votes=0, down_votes=0)
model.put()
return render_template("reset_votes.html")
+@AdYouLation.route('/show_votes')
+def show_votes():
+ results = VideoVotes.all()
+ return render_template("show_votes.html", results=results)
+
def create_playlist():
videos = current_app.videos
keys = videos["videos"].keys()
View
9 gae_flask_app/templates/show_votes.html
@@ -0,0 +1,9 @@
+{% extends "layout.html" %}
+{% block body %}
+ <h1>Leaderboard</h1>
+ <ul>
+ {% for vv in results %}
+ <li>{{ vv.name }}: up={{ vv.up_votes }}, down={{ vv.down_votes }}</li>
+ {% endfor %}
+ </ul>
+{% endblock %}
Please sign in to comment.
Something went wrong with that request. Please try again.