diff --git a/project_server.py b/project_server.py index 6b4f7a08ea524499c2d7e7fbd160f0187ab170bd..5dc787cb73551e1d0d69a7a54a80b7bdfbc37978 100644 --- a/project_server.py +++ b/project_server.py @@ -42,37 +42,26 @@ def returnListLocations(): conn.close() return render_template("Locations.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 ) +@app.route("/Load/Page/<Name>") + +def Load(Name=None): + + conn = sqlite3.connect(DATABASE) + cur = conn.cursor() + print(Name) + PageName = Name + cur.execute("SELECT Additional_photos FROM 'coworking_spaces' WHERE Name = ?;", [Name]) + AddPhotos = cur.fetchall() + ImageStr="".join(str(x) for x in AddPhotos) + ListImage = ImageStr.split(',') + FirstImage = ListImage[0] + FirstImage = FirstImage[2::] + cur.execute("UPDATE 'coworking_spaces' SET Additional_photos= ? ",[FirstImage]) + cur.execute("SELECT * FROM 'coworking_spaces' WHERE Name =?;", [Name]) + data = cur.fetchall() + print(data) + conn.close() + return render_template('Space.html', data = data) @app.route("/SearchRecord", methods=['POST', 'GET']) def searchRecord(): diff --git a/templates/Locations.html b/templates/Locations.html index 9945f324443a2409af0993c7ba25217dddc92256..f37b11920e4c0ccef1e8adaac0b42cc238ac84e4 100644 --- a/templates/Locations.html +++ b/templates/Locations.html @@ -21,7 +21,7 @@ <li> <div class="container"> <img src= "{{data[x][1]}}" class="image" > - <h2> {{data[x][0]}} </h2> + <h2 onclick="window.location.href='/Load/Page/{{data[x][0]}}'"> {{data[x][0]}} </h2> <p>hhhhhhhhhhhhhhhhhhhhhhhhhhh</p> <div class= star> <span class="fa fa-star fa-3x checked" ></span>