From 418ea9c2e95c4529011fbed47a7c00902ce16253 Mon Sep 17 00:00:00 2001 From: Xevion Date: Tue, 21 Jan 2020 06:24:45 -0600 Subject: [PATCH] add basic "Seasons" view --- .gitignore | 1 + app/routes.py | 2 +- app/templates/season.html | 4 +++- app/templates/view.html | 9 +++++++++ 4 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 app/templates/view.html diff --git a/.gitignore b/.gitignore index a2e4b43..f51df2f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ app.db keys.json process.py app.db-journal +test.html # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/app/routes.py b/app/routes.py index efd0199..9f5ae46 100644 --- a/app/routes.py +++ b/app/routes.py @@ -16,4 +16,4 @@ def view(): return render_template('episode.html', episode=Episode.query.filter_by(season_id=season, number=episode).first_or_404()) else: return render_template('season.html', season=Season.query.filter_by(id=season).first_or_404()) - return redirect(url_for('index')) \ No newline at end of file + return render_template('view.html', seasons=Season.query.all()) \ No newline at end of file diff --git a/app/templates/season.html b/app/templates/season.html index 330244e..aec2de8 100644 --- a/app/templates/season.html +++ b/app/templates/season.html @@ -2,8 +2,10 @@ {% block body %} {{ super() }} Season {{ season.id }} +
{% for episode in season.episodes %} -Episode {{ episode.number }} +Episode {{ episode.number }} +
{% endfor %} {% endblock body %} \ No newline at end of file diff --git a/app/templates/view.html b/app/templates/view.html new file mode 100644 index 0000000..2af8502 --- /dev/null +++ b/app/templates/view.html @@ -0,0 +1,9 @@ +{% extends 'base.html' %} +{% block body %} +{{ super() }} +{% for season in seasons %} +Season {{ season.id }} +
+{% endfor %} + +{% endblock body %} \ No newline at end of file