Skip to content
Snippets Groups Projects
Verified Commit fd0d8e78 authored by Robert Metcalf's avatar Robert Metcalf
Browse files

show workspaces on home page

parent a6a320f5
No related branches found
No related tags found
1 merge request!4Add Flask server, templates and initial database support
from flask import Flask, request, render_template from flask import Flask, request, render_template
import database
app = Flask(__name__) app = Flask(__name__)
@app.route("/", methods = ["GET"]) @app.route("/", methods = ["GET"])
def home(): def home():
if request.method == "GET": if request.method == "GET":
return render_template("home.html") workspaces = database.get_workspaces()
return render_template("home.html", workspaces = workspaces)
if __name__ == "__main__": if __name__ == "__main__":
app.run(debug = True) app.run(debug = True)
{% extends "main.html" %} {% extends "main.html" %}
{% block title %}Home{% endblock %} {% block title %}Home{% endblock %}
\ No newline at end of file {% block mainBlock %}
<ul>
{% for workspace in workspaces %}
<li><a href="{{ workspace.website }}">{{ workspace.name }}</a></li>
<img src="{{ workspace.main_photo }}">
<ul>
<li>{{ workspace.address }}</li>
<li>{{ workspace.description }}</li>
<li>{{ workspace.email }}</li>
<li>{{ workspace.phone_number }}</li>
<li>{{ workspace.opening_hours }}</li>
<li>{{ workspace.checkin_instructions }}</li>
</ul>
{% endfor %}
</ul>
{% endblock %}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment