def _removerent(): if request.method == "POST": with get_db() as conn: home_id = request.form["home-id"] removerent(conn, home_id) return "SUCCESS" else: return "ERROR! PLEASE TRY AGAIN."
def main(): with get_db() as conn: with open('sqlite-schema.sql') as f: conn.executescript(f.read()) conn.commit() with open('test-data.sql') as f: conn.executescript(f.read()) conn.commit()
def _salesort2(): with get_db() as conn: rows = hightolow(conn) return render_template("table1.html", name="Sorted Prices High to Low (For Sale)", rows=rows)
def _salestatus(): if request.method == "POST": with get_db() as conn: home_id = request.form["home-id"] status = request.form["status"] salestatus(conn,home_id, status) return "SUCCESS" else: return "ERROR! PLEASE TRY AGAIN."
def _listrent(): if request.method == "POST": with get_db() as conn: status = request.form["status"] rentprice = request.form["rentprice"] address = request.form["address"] beds = request.form["beds"] baths = request.form["baths"] size = request.form["size"] agent_id = request.form["agent-id"] add_homerent(conn, status, rentprice, address, beds, baths, size, agent_id) return "SUCCESS" else: return "ERROR! PLEASE TRY AGAIN."
def _salesort(): with get_db() as conn: rows = lowtohigh(conn) return render_template("table1.html", name="Sorted Prices Low to High (For Sale)", rows=rows)
def _sale(): with get_db() as conn: rows = forsale(conn) return render_template("table1.html", name="Homes For Sale", rows=rows)
def removerentpage(): with get_db() as conn: rows = forrent(conn) return render_template("removerent.html", name="Remove Home For Rent", rows=rows)
def removesalepage(): with get_db() as conn: rows = forsale(conn) return render_template("removesale.html", name="Remove Home For Sale", rows=rows)
def rentstatuspage(): with get_db() as conn: rows = forrent(conn) return render_template("rentstatus.html", name="Change Status (For Rent)", rows=rows)
def salestatuspage(): with get_db() as conn: rows = forsale(conn) return render_template("salestatus.html", name="Change Status (For Sale)", rows=rows)