hanze/programmeerles-ouderen

Merge branch 'dev' of https://github.com/MoiBaguette/Flask_Tutorial into dev (66818cc5d47bbed0cd23965d6a8b7f06aa885484)
Repositories

commit 66818cc5d47bbed0cd23965d6a8b7f06aa885484
parent 488952301943aa1b1a92a0d8c3c96b877c274490
Author: Friedel Schön <[email protected]>
Date:   Sun, 17 Apr 2022 14:10:00 +0200

Merge branch 'dev' of https://github.com/MoiBaguette/Flask_Tutorial into dev

Diffstat:
Mpgmles/forms.py2+-
Mpgmles/routes.py10+++++-----
Mpgmles/templates/course_overview.html15++++++++++++---
Mpgmles/templates/new_course.html2+-
4 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/pgmles/forms.py b/pgmles/forms.py @@ -61,7 +61,7 @@ class NewCourseForm(FlaskForm): start = StringField('Begin', validators=[ DataRequired() ]) end = StringField('Einde', validators=[ DataRequired() ]) location = StringField('Locatie', validators=[ DataRequired(), Length(min=1, max=100) ]) - submit = SubmitField('Bewerken') + submit = SubmitField('Versturen') """ subscribe form for course.html """ class SubscribeForm(FlaskForm): diff --git a/pgmles/routes.py b/pgmles/routes.py @@ -155,7 +155,7 @@ def course_overview(): if current_user.type not in [ "admin", "teacher" ]: abort(403) courses = [ (c, User.query.filter_by(id=c.id).first() ) for c in Course.query.all() ] - return render_template('course_overview.html', calendar=make_calendar(), title='Lesoverzicht', courses=courses) + return render_template('course_overview.html', calendar=make_calendar(), legend='Lesoverzicht', courses=courses) """ new_course.html route """ @app.route("/course/new", methods=['GET', 'POST']) @@ -171,7 +171,7 @@ def new_course(): db.session.commit() flash('De les werd toegevoegd!', 'success') return redirect(url_for('course_overview')) - return render_template('new_course.html', calendar=make_calendar(), title='Nieuwe les', form=form) + return render_template('new_course.html', calendar=make_calendar(), legend='Nieuwe les aanmaken', form=form) """ new_course.html (update course) route """ @app.route("/course/<int:course_id>/update", methods=['GET', 'POST']) @@ -201,7 +201,7 @@ def update_course(course_id): form.start.data = course.start form.end.data = course.end form.location.data = course.location - return render_template('new_course.html', calendar=make_calendar(), form=form, legend='Update Language') + return render_template('new_course.html', calendar=make_calendar(), form=form, legend='Les aanpassen') """ delete-course route """ @app.route("/course/<int:course_id>/delete", methods=['GET','POST']) @@ -224,9 +224,9 @@ def admin(): if form.validate_on_submit(): user = User.query.filter_by(username=form.username.data).first() if user == None: - flash(f'Geen gebruker gevonden: {form.username.data}', 'danger') + flash(f'Geen gebrukers gevonden met de gebruikersnaam: {form.username.data}!', 'danger') else: - flash(f'Gebruiker gevonden: {form.username.data}', 'success') + flash(f'Gebruiker gevonden met gebruikersnaam: {form.username.data}!', 'success') return redirect(url_for('admin_user', user_id= user.id)) return render_template('admin.html', calendar=make_calendar(), form=form) diff --git a/pgmles/templates/course_overview.html b/pgmles/templates/course_overview.html @@ -1,8 +1,17 @@ {% extends "layout.html" %} {% block content %} -<h1>Course Overview - <a class="btn btn-secondary btn-sm mt-1 mb-1" href="{{ url_for('new_course') }}">Nieuwe les</a> -</h1> +<article class="media content-section"> + <legend class="border-bottom mb-4"> + <h1>{{ legend }}</h1> + </legend> +</article> +<article class="media content-section"> + <div class="media-body"> + <div> + <a class="btn btn-secondary btn-sm mt-1 mb-1" href="{{ url_for('new_course') }}">Nieuwe les</a> + </div> + </div> +</article> {% for course, teacher in courses %} <article class="media content-section"> <div class="media-body"> diff --git a/pgmles/templates/new_course.html b/pgmles/templates/new_course.html @@ -4,7 +4,7 @@ <form method="POST" action=""> {{ form.hidden_tag() }} <fieldset class="form-group"> - <legend class="border-bottom mb-4">{{ legend }}</legend> + <legend class="border-bottom mb-4"><h1>{{ legend }}</h1></legend> <div class="form-group"> {{ form.name.label(class="form-control-label") }} {% if form.name.errors %}