From a15a2b3344cdb79013a5ee0de75ad98e29d5d657 Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 20 Jan 2020 18:47:45 -0600 Subject: [PATCH] add in html pages for season and episode, baseline zero css --- app/models.py | 2 +- app/routes.py | 2 +- app/templates/base.html | 13 +++++++++++++ app/templates/content.html | 4 ++++ app/templates/episode.html | 10 ++++++++++ app/templates/season.html | 9 +++++++++ 6 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 app/templates/content.html diff --git a/app/models.py b/app/models.py index e381471..6d32633 100644 --- a/app/models.py +++ b/app/models.py @@ -53,7 +53,7 @@ class Season(db.Model): @property def episodes(self): """returns a List of Episodes under this Season""" - return Episode.query.filter_by(season_id=self.id).all().sort(key=lambda ep : ep.number) + return Episode.query.filter_by(season_id=self.id).all() @property def characters(self, sort): diff --git a/app/routes.py b/app/routes.py index 1666312..efd0199 100644 --- a/app/routes.py +++ b/app/routes.py @@ -13,7 +13,7 @@ def view(): if season != -1: if episode != -1: - return render_template('episode.html', episode=Episode.query.filter_by(season_id=season, episode=episode).first_or_404()) + 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 diff --git a/app/templates/base.html b/app/templates/base.html index e69de29..4cbd66b 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -0,0 +1,13 @@ + + + + The Office Quotes{% if title %} - {{ title }}{% endif %} + {% block head %} + {% endblock head %} + + + + {% block body %} + + {% endblock body %} + \ No newline at end of file diff --git a/app/templates/content.html b/app/templates/content.html new file mode 100644 index 0000000..a185b0d --- /dev/null +++ b/app/templates/content.html @@ -0,0 +1,4 @@ +{% extends 'base.html' %} +{% block body %} +{{ super() }} +{% endblock body %} \ No newline at end of file diff --git a/app/templates/episode.html b/app/templates/episode.html index e69de29..bbdfcf8 100644 --- a/app/templates/episode.html +++ b/app/templates/episode.html @@ -0,0 +1,10 @@ +{% extends 'content.html' %} +{% block body %} +{% for section in episode.sections %} +{% for quote in section.quotes %} +{{ quote.speaker }}: {{ quote.text }} +
+{% endfor %} +
+{% endfor %} +{% endblock body %} \ No newline at end of file diff --git a/app/templates/season.html b/app/templates/season.html index e69de29..330244e 100644 --- a/app/templates/season.html +++ b/app/templates/season.html @@ -0,0 +1,9 @@ +{% extends 'base.html' %} +{% block body %} +{{ super() }} +Season {{ season.id }} +{% for episode in season.episodes %} +Episode {{ episode.number }} +{% endfor %} + +{% endblock body %} \ No newline at end of file