add basic "Seasons" view

This commit is contained in:
Xevion
2020-01-21 06:24:45 -06:00
parent 7cb1121cd0
commit 418ea9c2e9
4 changed files with 14 additions and 2 deletions

1
.gitignore vendored
View File

@@ -5,6 +5,7 @@ app.db
keys.json
process.py
app.db-journal
test.html
# Byte-compiled / optimized / DLL files
__pycache__/

View File

@@ -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'))
return render_template('view.html', seasons=Season.query.all())

View File

@@ -2,8 +2,10 @@
{% block body %}
{{ super() }}
Season {{ season.id }}
<br>
{% for episode in season.episodes %}
<a href="/view?season={{ season.id }}&episode={{ episode.number }}" >Episode {{ episode.number }}</a>
<a href="/view?season={{ season.id }}&episode={{ episode.number }}" >Episode {{ episode.number }}</a>
<br>
{% endfor %}
{% endblock body %}

9
app/templates/view.html Normal file
View File

@@ -0,0 +1,9 @@
{% extends 'base.html' %}
{% block body %}
{{ super() }}
{% for season in seasons %}
<a href="/view?season={{ season.id }}" >Season {{ season.id }}</a>
<br>
{% endfor %}
{% endblock body %}