mirror of
https://github.com/StefBuwalda/WebTech.git
synced 2025-10-30 11:19:58 +00:00
Automatic services added to dashboard
This commit is contained in:
@@ -4,6 +4,12 @@
|
|||||||
|
|
||||||
{%block content%}
|
{%block content%}
|
||||||
<div class="grid-container">
|
<div class="grid-container">
|
||||||
|
{% for service in services%}
|
||||||
|
<div class="container-xxl">
|
||||||
|
name: {{service["name"]}} <br>
|
||||||
|
url: {{service["url"]}}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
<div class="container-xxl">
|
<div class="container-xxl">
|
||||||
Item 1
|
Item 1
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from flask import Blueprint, render_template
|
from flask import Blueprint, render_template
|
||||||
from flask_login import login_required # type: ignore
|
from flask_login import login_required # type: ignore
|
||||||
|
from application.dash.models import Service
|
||||||
|
|
||||||
dash_blueprint = Blueprint("dash", __name__, template_folder="templates")
|
dash_blueprint = Blueprint("dash", __name__, template_folder="templates")
|
||||||
|
|
||||||
@@ -9,4 +10,5 @@ dash_blueprint = Blueprint("dash", __name__, template_folder="templates")
|
|||||||
@dash_blueprint.route("/", methods=["GET", "POST"])
|
@dash_blueprint.route("/", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def index():
|
def index():
|
||||||
return render_template("dashboard.html")
|
services = Service.query.all() # type: ignore
|
||||||
|
return render_template("dashboard.html", services=services)
|
||||||
|
|||||||
5
seed.py
5
seed.py
@@ -12,13 +12,14 @@ new_strikers = [
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
new_user = User(username="admin", password=generate_password_hash("admin"))
|
new_user = User(username="admin", password=generate_password_hash("admin"))
|
||||||
|
new_services = Service(name="test123", url="http://google.com")
|
||||||
|
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
# Remove all existing
|
# Remove all existing
|
||||||
# Service.query.delete()
|
Service.query.delete()
|
||||||
User.query.delete()
|
User.query.delete()
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
# Then add new
|
# Then add new
|
||||||
# db.session.add_all(new_strikers)
|
db.session.add(new_services)
|
||||||
db.session.add(new_user)
|
db.session.add(new_user)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|||||||
Reference in New Issue
Block a user