Skip to content
Snippets Groups Projects
Commit 349b4e8c authored by Liam Driscoll's avatar Liam Driscoll
Browse files

Adding a basic location list and a route to call the locations for a basis to work off of.

parent 7fca490a
No related branches found
No related tags found
3 merge requests!58Resolve "As a user I want to view a list of all locations available",!50ZAINABS work + my basic list locations page and route to help with this issue,!46form, templating, database connection and some CSS updates
......@@ -28,6 +28,52 @@ def returnManageCoworkingSpaces():
if (request.method == 'GET'):
return render_template("Manage_Coworking_Spaces.html")
<<<<<<< Updated upstream
=======
@app.route("/ListLocations", methods=['GET'])
def returnListLocations():
if (request.method =='GET'):
conn = connect_db()
cur = conn.cursor()
cur.execute("SELECT Name, Main_Photo FROM coworking_spaces")
locationData = cur.fetchall()
conn.close()
return render_template("ListLocations.html", data = locationData)
@app.route("/Load/CodeBase")
def Load():
Name = "Codebase";
conn = sqlite3.connect(DATABASE)
cur = conn.cursor()
print(Name)
# getAddress(Name)
cur.execute("SELECT * FROM 'coworking_spaces' WHERE Name =?;", [Name])
data = cur.fetchall()
print(data)
# cur.execute("SELECT Address FROM coworking_spaces WHERE Name =? ;", [Name])
# Address = cur.fetchall()
# print(Address)
# cur.execute("SELECT Main_Photo FROM coworking_spaces WHERE Name =? ;", [Name])
# Main_Photo = cur.fetchall()
# print(Main_Photo)
# cur.execute("SELECT Additional_photos FROM coworking_spaces WHERE Name =? ;", [Name])
# Additional_photos = cur.fetchall()
# print(Additional_photos)
# cur.execute("SELECT Description FROM coworking_spaces WHERE Name =? ;", [Name])
# Description = cur.fetchall()
# print(Description)
# cur.execute("SELECT Website FROM coworking_spaces WHERE Name =? ;", [Name])
# Website = cur.fetchall()
# print(Website)
# cur.execute("SELECT Opening_Hours FROM coworking_spaces WHERE Name =? ;", [Name])
# Opening_Hours = cur.fetchall()
# print(Opening_Hours)
conn.close()
return render_template('Space.html', data = data)
# pageAddress = Address, pageMain_Photo = Main_Photo, pageAdditional_photos = Additional_photos, pageDescription = Description, pageWebsite = Website, pageOpening_Hours = Opening_Hours )
>>>>>>> Stashed changes
@app.route("/SearchRecord", methods=['POST', 'GET'])
def searchRecord():
......
{%extends "base_template.html"%}
{%block headblock%}
<title> Locations </title>
{%endblock%}
{%block headerblock%}
<a id="headerText"
href="ListLocations">
Locations</a>
{%endblock%}
{%block mainblock%}
<br><br>
{%if data%}
{%for x in range(data|length)%}
{{data[x][0]}}
{{data[x][1]}}
<br><br>
{%endfor%}
{%endif%}
{%endblock%}
{%block jsblock%}
{%endblock%}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment