diff --git a/app.py b/app.py index 85dcb01..0141619 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,6 @@ from application import app from flask import redirect, url_for -from flask_login import current_user, login_required +from flask_login import current_user # type: ignore # home route diff --git a/application/dash/forms.py b/application/dash/forms.py index 57d8c19..ffe3465 100644 --- a/application/dash/forms.py +++ b/application/dash/forms.py @@ -1,4 +1,4 @@ -from flask_wtf import FlaskForm +from flask_wtf import FlaskForm # type: ignore from wtforms import StringField, SubmitField, URLField from wtforms.validators import DataRequired diff --git a/application/dash/views.py b/application/dash/views.py index 7c1b799..f6b8878 100644 --- a/application/dash/views.py +++ b/application/dash/views.py @@ -1,63 +1,12 @@ -from flask import ( - Blueprint, - render_template, - redirect, - url_for, - request, - flash, - session, - get_flashed_messages, -) -from application import db -from application.dash.models import Service -from application.dash.forms import ServiceForm -from flask_login import login_required, current_user +from flask import Blueprint, render_template +from flask_login import login_required # type: ignore dash_blueprint = Blueprint("dash", __name__, template_folder="templates") # Routes -""" -@strike_blueprint.route("/bedankt", methods=["GET"]) -def thanks(): - return render_template("bedankt.html") -""" - @dash_blueprint.route("/", methods=["GET", "POST"]) @login_required def index(): - """ - session["_flashes"] = [] - my_form = ServiceForm() - - if request.method == "POST": - if my_form.validate_on_submit(): - flash("Het formulier is succesvol gePOST") - - session["naam"] = my_form.name.data - session["url"] = my_form.url.data - flash("De gegevens zijn in de sessie opgeslagen") - - new_service = Service(name=my_form.name.data, url=my_form.url.data) - db.session.add(new_service) - db.session.commit() - flash("De gegevens zijn in de database opgeslagen") - - return redirect(url_for("application.dash")) - else: - flash("Het formulier is niet goed ingevuld") - """ - # return render_template("dashboard.html", form=my_form) return render_template("dashboard.html") - - -""" -@strike_blueprint.route("/stakers") -@login_required -def strikers(): - rows = Striker.query.all() - return render_template( - "strikers.html", rows=rows, user=current_user.username - ) -""" diff --git a/forms.py b/forms.py deleted file mode 100644 index 57d8c19..0000000 --- a/forms.py +++ /dev/null @@ -1,9 +0,0 @@ -from flask_wtf import FlaskForm -from wtforms import StringField, SubmitField, URLField -from wtforms.validators import DataRequired - - -class ServiceForm(FlaskForm): - name = StringField("Service name:", validators=[DataRequired()]) - url = URLField("Service URL:", validators=[DataRequired()]) - submit = SubmitField("Add") diff --git a/run.py b/run.py deleted file mode 100644 index a29d891..0000000 --- a/run.py +++ /dev/null @@ -1,37 +0,0 @@ -from flask import Flask, render_template, session -from forms import ServiceForm - -# Create Flask instance -app = Flask(__name__) -app.config["SECRET_KEY"] = "mijngeheimesleutel" - - -# Default app route -@app.route("/") -def index(): - # Return HTML content - return "

This is the default page

" - - -@app.route("/dashboard") -def dashboard(): - # Return Dashboard.html - return render_template("dashboard.html") - - -@app.route("/forms", methods=["GET", "POST"]) -def forms(): - form = ServiceForm() - - if form.validate_on_submit: # type: ignore - session["name"] = form.name.data - session["url"] = form.url.data - - form = ServiceForm(formdata=None) - return render_template("forms.html", form=form) - - -# Prevent execution when imported by other script -if __name__ == "__main__": - # Start the flask server in debug mode for development purposes - app.run(port=80, debug=True) diff --git a/static/.gitkeep b/static/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/static/style.css b/static/style.css deleted file mode 100644 index b912c98..0000000 --- a/static/style.css +++ /dev/null @@ -1,22 +0,0 @@ -body { - background-color: lightslategray; -} - -.grid-container { - display: grid; - grid-template-columns: auto auto auto; - gap: 20px; - background-color: lightslategray; - padding-top: 20px; - margin-left: 10%; - margin-right: 10%; -} - -.grid-container > div { - text-align: center; - height: 100px; - padding-top: 5px; - border: 2px solid black; - border-radius: 10px; - background-color: whitesmoke; -} \ No newline at end of file diff --git a/templates/.gitkeep b/templates/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/templates/base_template.html b/templates/base_template.html deleted file mode 100644 index ba26656..0000000 --- a/templates/base_template.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - {% block title %}{% endblock %} - - - - {% block content %} - {% endblock %} - - \ No newline at end of file diff --git a/templates/dashboard.html b/templates/dashboard.html deleted file mode 100644 index ce86b46..0000000 --- a/templates/dashboard.html +++ /dev/null @@ -1,26 +0,0 @@ -{% extends "base_template.html" %} - -{%block title%}Dashboard{%endblock%} - -{%block content%} -
-
- Item 1 -
-
- Item 2 -
-
- Item 3 -
-
- Item 4 -
-
- Item 5 -
-
- Item 6 -
-
-{%endblock%} \ No newline at end of file