diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json index d282b3b2429acfde2dec7effcded342bf9fd7122..ba3df8227239edb72899c65d3bdf69babdd274d1 100644 --- a/.vs/VSWorkspaceState.json +++ b/.vs/VSWorkspaceState.json @@ -4,4 +4,4 @@ ], "SelectedNode": "\\README.md", "PreviewInSolutionExplorer": false -} \ No newline at end of file +} diff --git a/.vs/client-project-15/v16/.suo b/.vs/client-project-15/v16/.suo new file mode 100644 index 0000000000000000000000000000000000000000..12e21838967c4d3de5d5051b0c5e3d000e1df61f Binary files /dev/null and b/.vs/client-project-15/v16/.suo differ diff --git a/database.db b/database.db new file mode 100644 index 0000000000000000000000000000000000000000..6e0c2a9676ca7d4128d05d7cdde27bcd5ecb5a11 Binary files /dev/null and b/database.db differ diff --git a/database.py b/database.py index 298894d9ecee62ba3794fbe03767b930ca2d7a06..80aaa96f8fb2b77f826f70ebd72d8e4aab5080dc 100644 --- a/database.py +++ b/database.py @@ -113,7 +113,7 @@ class Workspace: def from_query(conn, tuple): (id, name, address, main_photo, description, website, email, phone_number, opening_hours, checkin_instructions) = tuple additional_photos = [] - + conn.execute("SELECT url FROM AdditionalPhotos WHERE workspace_id = ?", (str(id))) for x in conn.cursor.fetchall(): additional_photos.append(x[0]) @@ -138,3 +138,6 @@ def get_workspaces(): with Connection() as conn: conn.execute("SELECT * FROM Workspaces") return [Workspace.from_query(conn, x) for x in conn.cursor.fetchall()] + + +print(get_workspaces()) diff --git a/main.py b/main.py index ba4680310f17fe96a479bee1a071b0f51a60ee26..d566b8325631476ec58f92a25526f26604fc0bbf 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,4 @@ -from flask import Flask, request, render_template +from flask import Flask, request, render_template, redirect import database import json import re @@ -11,6 +11,15 @@ def home(): workspaces = database.get_workspaces() return render_template("home.html", workspaces = workspaces) +@app.route('/login', methods = ["GET", "POST"]) +def login(): + username = request.form.get('username') + if username == "admin": + return redirect("/") + else: + message = "Wrong Username" + return render_template("/login.html") + @app.route("/about", methods = ["GET"]) def about(): return render_template("about.html") diff --git a/static/style.css b/static/style.css index af58c8b2dcd7bc3516e77342968bb76b5938fec2..0ad81b3e800574b86711d0910f7c5ac2b17259d8 100644 --- a/static/style.css +++ b/static/style.css @@ -67,6 +67,9 @@ nav ul { background-color: black; } +form{ + text-align: center; +} nav li a { display: block; @@ -75,6 +78,13 @@ nav li a { padding: 14px 16px; text-decoration: none; } +nav ul p { + display: block; + color: white; + float: left; + padding: 18px 20px; + text-decoration: none; +} nav li a:hover { diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000000000000000000000000000000000000..186cc02476c64b6c0a162666112f6cf67c0316ee --- /dev/null +++ b/templates/login.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + + <link rel="stylesheet" href="static/style.css"> + + <!-- Bootstrap CSS --> + <link rel="stylesheet" href= +"https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" + integrity= +"sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" + crossorigin="anonymous"> + + <title>{% block title %}{% endblock %} - Tramshed Workspaces</title> +</head> +<body class="body"> + <header><img src="/static/Tramshed_Logo.jpg" alt="Logo" height="50" width="100" >Login</header> + + <nav> +<ul> + <p></p> +</ul> + </nav> + +<!-- <div class="parallax"> +<body class="body"> + <!--<img src="static/Tramshed_Logo.jpg" alt="Logo" height="50" width="100">--> +<!-- navigation --> + +<form class='myForm' method="POST" action=""> + <p>Enter Username: </p> + <br> + <input type = "text" name = "username" placeholder="Username.." ><br> + <button type = "submit" id='mySubmit'> Submit </button> +</form> +<!--{% block mainBlock %}{% endblock %}--> + </body> +</html>