20 lines
424 B
Python
20 lines
424 B
Python
# Searches for shows using LIKE
|
|
|
|
from cs50 import SQL
|
|
from flask import Flask, render_template, request
|
|
|
|
app = Flask(__name__)
|
|
|
|
db = SQL("sqlite:///shows.db")
|
|
|
|
|
|
@app.route("/")
|
|
def index():
|
|
return render_template("index.html")
|
|
|
|
|
|
@app.route("/search")
|
|
def search():
|
|
shows = db.execute("SELECT * FROM shows WHERE title LIKE ?", "%" + request.args.get("q") + "%")
|
|
return render_template("search.html", shows=shows)
|