Browse files

Render the ids of the videos in new handler+template

  • Loading branch information...
1 parent f6d21df commit d2f78e63d9bd44d7bdd4dc08532e3c6a1ab600ce @georgevreilly committed Feb 2, 2013
View
5 gae_flask_app/AdYouLation/__init__.py
@@ -0,0 +1,5 @@
+from flask import Blueprint
+
+AdYouLation = Blueprint('AdYouLation', __name__)
+
+import handlers
View
8 gae_flask_app/AdYouLation/handlers.py
@@ -0,0 +1,8 @@
+from ..AdYouLation import AdYouLation
+from flask import render_template, current_app
+
+@AdYouLation.route('/start')
+def start():
+ videos = current_app.videos
+ keys = videos["videos"].keys()
+ return render_template("start.html", names=keys)
View
7 gae_flask_app/app.py
@@ -7,11 +7,16 @@
def create_app(config):
app = Flask(__name__)
app.config.from_object(config)
+
json_filename = app.config['VIDEO_JSON']
- vj = load_video_json(json_filename)
+ app.videos = load_video_json(json_filename)
logging.info("Loaded video data from '%s'", json_filename)
# Register blueprints here.
from gae_flask_app.hello_gae import hello_gae
app.register_blueprint(hello_gae, url_prefix="/")
+
+ from gae_flask_app.AdYouLation import AdYouLation
+ app.register_blueprint(AdYouLation)
+
return app
View
10 gae_flask_app/templates/layout.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<title>AdYouLation</title>
+<link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}">
+<div class=page>
+ <h1>AdYouLation</h1>
+ {% for message in get_flashed_messages() %}
+ <div class=flash>{{ message }}</div>
+ {% endfor %}
+ {% block body %}{% endblock %}
+</div>
View
10 gae_flask_app/templates/start.html
@@ -0,0 +1,10 @@
+{% extends "layout.html" %}
+{% block body %}
+ <ul class=entries>
+ {% for video in names %}
+ <li><h2>{{ video }}</h2>
+ {% else %}
+ <li><em>Unbelievable. No entries here so far</em>
+ {% endfor %}
+ </ul>
+{% endblock %}

0 comments on commit d2f78e6

Please sign in to comment.