Skip to content
Snippets Groups Projects
Commit c8baca3c authored by Beaumont Mogridge's avatar Beaumont Mogridge :gorilla:
Browse files

Update templates/Space.html, WorkSpaces.sql, main.py

parent 66a06171
No related branches found
No related tags found
1 merge request!47Update static/testSearch.html, templates/OurSpaces.html, templates/Space.html,...
DELETE FROM 'coworking_spaces' WHERE Name = 'Name';
--DROP TABLE IF EXISTS coworking_spaces;
--CREATE TABLE IF NOT EXISTS 'coworking_spaces' (
--`Name` TEXT NOT NULL,
--`Address` TEXT NOT NULL,
--`Main_Photo` TEXT NOT NULL,
--`Additional_photos` TEXT NOT NULL,
--`Description` TEXT NOT NULL,
--`Website` TEXT NOT NULL,
--`Email` TEXT NOT NULL,
--`Phone_Number` TEXT NOT NULL,
--`Opening_Hours` TEXT NOT NULL,
--`Checkin_Instructions` TEXT NOT NULL,
--);
--INSERT INTO 'coworking_spaces'('Name','Address', 'Main_Photo', 'Additional_photos','Description','Website','Email','Phone_Number','Opening_Hours','Checkin_Instructions') VALUES ('Codebase CodeBase Edinburgh' , '37a Castle Terrace, Edinburgh, EH1 2EL ', 'https://images.squarespace-cdn.com/content/v1/55439320e4b0f92b5d6c4c8b/1646867535415-4JI39H286BUMT26H4FHN/C36A1915.jpg?format=2500w',' https://images.squarespace-cdn.com/content/v1/55439320e4b0f92b5d6c4c8b/1646868533510-J1OT4PEG5VM9FCBF8BJE/15.10.19_-_CREATIVE_BRIDGE_C02_-_DAY01_-_LQ-19+%281%29.jpg?format=2500w','https://images.squarespace-cdn.com/content/v1/55439320e4b0f92b5d6c4c8b/1646868421127-07KQ4N1OHTDDKQME686A/15.10.19_-_CREATIVE_BRIDGE_C02_-_DAY01_-_LQ-52+%281%29.jpg?format=2500w', 'Hi. We’re CodeBase. We've been exploring the world of startups and innovation for over five years now. We're not really sure how to best describe what we do, but we think the words "tech cluster" probably do it best. Please get in touch! We’re friendly people who are geeky about building tech startups, managing disruption and innovation.', 'https://www.thisiscodebase.com','info@thisiscodebase.com','(+44) 0131 560 2003', '08:00 - 17:00',' Use the email address or phone number to call ahead and book a desk, let them know you're a Tramshed member');
......@@ -6,35 +6,29 @@ DATABASE = "db.db"
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'])
app = Flask(__name__)
@app.route("/Load/CodeBase", methods = ['GET','POST'])
@app.route("/Load/CodeBase")
def Load():
if request.method =='GET':
return render_template('Space.html')
if request.method =='POST':
try:
Name = "CodeBase";
conn = sqlite3.connect(DATABASE)
cur = conn.cursor()
document.getElementById("name").innerHTML= Name;
cur.execute("SELECT Address FROM coworking_spaces WHERE Name =? ;", [Name])
Address = cur.fetch();
cur.execute("SELECT Main_Photo FROM coworking_spaces WHERE Name =? ;", [Name])
Main_Photo = cur.fetch();
cur.execute("SELECT Additional_photos FROM coworking_spaces WHERE Name =? ;", [Name])
Additional_photos = cur.fetch();
cur.execute("SELECT Description FROM coworking_spaces WHERE Name =? ;", [Name])
Description = cur.fetch();
cur.execute("SELECT Website FROM coworking_spaces WHERE Name =? ;", [Name])
Website = cur.fetch();
cur.execute("SELECT Opening_Hours FROM coworking_spaces WHERE Name =? ;", [Name])
Opening_Hours = cur.fetch();
except:
print('error', data)
conn.close()
finally:
conn.close()
cur.execute("SELECT * FROM coworking_spaces WHERE Name = 'CodeBase';")
data = cur.fetchall()
print(data)
# cur.execute("SELECT Address FROM coworking_spaces WHERE Name =? ;", [Name])
# Address = cur.fetchall()
# cur.execute("SELECT Main_Photo FROM coworking_spaces WHERE Name =? ;", [Name])
# Main_Photo = cur.fetchall()
# cur.execute("SELECT Additional_photos FROM coworking_spaces WHERE Name =? ;", [Name])
# Additional_photos = cur.fetchall()
# cur.execute("SELECT Description FROM coworking_spaces WHERE Name =? ;", [Name])
# Description = cur.fetchall()
# cur.execute("SELECT Website FROM coworking_spaces WHERE Name =? ;", [Name])
# Website = cur.fetchall()
# cur.execute("SELECT Opening_Hours FROM coworking_spaces WHERE Name =? ;", [Name])
# Opening_Hours = cur.fetchall()
return render_template('Space.html', data = data)
return str(data)
conn.close()
......
{%extends 'OurSpaces.html'%}
<form id='myForm' action='/Load/CodeBase>' method ='post'>
{% block titleBlock%}
<p id="name"></p>
<img src= Main_Photo ><br>"/>
<script>
document.getElementById("name").innerHTML = Name;
<h1 id="name"></h1><br>
<td>data</td>
<img src= Main_Photo><br>
<<script type="text/javascript">
document.getElementById("name").innerHTML= data;
</script>
<table border = 1>
<thead>
<td>Name</td>
<td>Address</td>
<td>Main_Photo</td>
<td>Additional_photos</td>
<td>Description</td>
<td>Website</td>
<td>Opening_Hours</td>
</thead>
{% for row in data %}
<tr>
<td>{{row[0]}}</td>
<td>{{row[1]}}</td>
<td>{{row[2]}}</td>
<td>{{row[3]}}</td>
<td>{{row[4]}}</td>
<td>{{row[5]}}</td>
<td>{{row[6]}}</td>
</tr>
{% endfor %}
</table>
{%endblock%}
{% block addressBlock%}
<h2><input type = "text" name = "Name"><br></h2>
<h2><br></h2>
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d4957.954181608377!2d-2.999839445369478!3d51.58698324808131!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x4871e6cc3bd82553%3A0x684c1227f14b4a15!2sNational%20Software%20Academy%20(Cardiff%20University)!5e0!3m2!1sen!2suk!4v1669722978098!5m2!1sen!2suk"
width="600" height="450" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
{%endblock%}
......@@ -31,6 +56,32 @@ document.getElementById("name").innerHTML = Name;
<span id='txt'></span>
<script>
function loadSpace() {
var Name = document.forms["coworking_spaces"]["Name"].value;
var Address = document.forms["coworking_spaces"]["Address"].value;
var Main_Photo = document.forms["coworking_spaces"]["Main_Photo"].value;
var Additional_photos = document.forms["coworking_spaces"]["Main_Photo"].value;
var Description = document.forms["coworking_spaces"]["Description"].value;
var Website = document.forms["coworking_spaces"]["Website"].value;
var Opening_Hours = document.forms["coworking_spaces"]["Opening_Hours"].value;
var xhttp = new XMLHttpRequest();
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.onload = function() {
if (xhttp.readyState === 4 && xhttp.status === 200) {
console.log(xhttp.responseText);
document.getElementById("txt").innerHTML = xhttp.responseText;
} else {
console.error(xhttp.statusText);
}
};
xhttp.send(params);
return false;
}
</script>
</form>
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