From fba683a0a60dc820077571c6f0ce8bc8436ad787 Mon Sep 17 00:00:00 2001 From: Stef Date: Wed, 16 Apr 2025 12:26:59 +0200 Subject: [PATCH] 123123123 --- application/dash/templates/dashboard.html | 24 +++++++++++++------- application/dash/templates/edit_service.html | 9 ++++++++ application/dash/views.py | 10 ++++++++ 3 files changed, 35 insertions(+), 8 deletions(-) create mode 100644 application/dash/templates/edit_service.html diff --git a/application/dash/templates/dashboard.html b/application/dash/templates/dashboard.html index 10badbc..da857fe 100644 --- a/application/dash/templates/dashboard.html +++ b/application/dash/templates/dashboard.html @@ -6,27 +6,35 @@
{% for service in services%}
-
+
Name: {{service["name"]}}
URL: {{service["url"]}}
- +
{% endfor %}
-{%endblock%} - \ No newline at end of file +{%endblock%} \ No newline at end of file diff --git a/application/dash/templates/edit_service.html b/application/dash/templates/edit_service.html new file mode 100644 index 0000000..75625cf --- /dev/null +++ b/application/dash/templates/edit_service.html @@ -0,0 +1,9 @@ +{% extends 'base_template.html' %} + +{% block title %} +Add service +{% endblock %} + +{% block content %} +123 +{% endblock %} \ No newline at end of file diff --git a/application/dash/views.py b/application/dash/views.py index 48f3f6f..dd31277 100644 --- a/application/dash/views.py +++ b/application/dash/views.py @@ -54,3 +54,13 @@ def service(): return render_template( "add_service.html", form=service_form, active_page="service" ) + + +@dash_blueprint.route("/edit_service/", methods=["POST"]) +@login_required +def edit_service(service_id: int): + service = Service.query.get_or_404(service_id) + if current_user.id != service.user_id: + redirect(url_for("dash.index")) + + return render_template("edit_service.html")