mirror of
https://github.com/Xevion/the-office.git
synced 2025-12-15 00:13:23 -06:00
check from query based parameters to path based parameters
This commit is contained in:
@@ -4,16 +4,12 @@ from app import app
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return 'WIP'
|
||||
return render_template('view.html', seasons=Season.query.all())
|
||||
|
||||
@app.route('/view')
|
||||
def view():
|
||||
season = request.args.get('season', default=-1, type=int)
|
||||
episode = request.args.get('episode', default=-1, type=int)
|
||||
|
||||
if season != -1:
|
||||
if episode != -1:
|
||||
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 render_template('view.html', seasons=Season.query.all())
|
||||
@app.route('/season/<season>/')
|
||||
def season(season):
|
||||
return render_template('season.html', season=Season.query.filter_by(id=season).first_or_404())
|
||||
|
||||
@app.route('/season/<season>/<episode>')
|
||||
def episode(season, episode):
|
||||
return render_template('episode.html', episode=Episode.query.filter_by(season_id=season, number=episode).first_or_404())
|
||||
Reference in New Issue
Block a user