Skip to content

Commit

Permalink
Render the ids of the videos in new handler+template
Browse files Browse the repository at this point in the history
  • Loading branch information
georgevreilly committed Feb 2, 2013
1 parent f6d21df commit d2f78e6
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
5 changes: 5 additions & 0 deletions gae_flask_app/AdYouLation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from flask import Blueprint

AdYouLation = Blueprint('AdYouLation', __name__)

import handlers
8 changes: 8 additions & 0 deletions gae_flask_app/AdYouLation/handlers.py
Original file line number Diff line number Diff line change
@@ -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)
7 changes: 6 additions & 1 deletion gae_flask_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 10 additions & 0 deletions gae_flask_app/templates/layout.html
Original file line number Diff line number Diff line change
@@ -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>
10 changes: 10 additions & 0 deletions gae_flask_app/templates/start.html
Original file line number Diff line number Diff line change
@@ -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.