commit 4f12a676a217f0f957f066f13f4ca1bc48c040fd
parent eb712aca9ab54dcb94a50970eb437ec07377c912
Author: gerco <[email protected]>
Date: Sun, 17 Apr 2022 13:35:48 +0200
kleine veranderingen opmaak en spelling
Diffstat:
18 files changed, 637 insertions(+), 434 deletions(-)
diff --git a/pgmles/__init__.py b/pgmles/__init__.py
@@ -1 +1 @@
-# deze bestand moet er zijn, anders zou Python's leuke module-system niet werken );
-\ No newline at end of file
+# deze bestand moet er zijn, anders zou Python's leuke module-system klagen );
+\ No newline at end of file
diff --git a/pgmles/forms.py b/pgmles/forms.py
@@ -6,6 +6,7 @@ from wtforms.validators import DataRequired, Email, EqualTo, Length, ValidationE
from .models import User
+""" registration form for register.html """
class RegistrationForm(FlaskForm):
username = StringField('Naam', validators=[ DataRequired(), Length(min=2, max=20) ])
email = StringField('E-Mail', validators=[ DataRequired(), Email() ])
@@ -13,15 +14,18 @@ class RegistrationForm(FlaskForm):
confirm_password = PasswordField('Wachtwoord herhalen', validators=[ DataRequired(), EqualTo('password') ])
submit = SubmitField('Registeren')
+ """ validates whether username is already in use """
def validate_username(self, username):
if User.query.filter_by(username=username.data).first():
raise ValidationError('Deze gebruikersnaam bestaat al, kies een andere.')
+ """ validates whether e-mail is already in use """
def validate_email(self, email):
if User.query.filter_by(email=email.data).first():
raise ValidationError('Deze e-mail bestaat al, log in als dat uw e-mail is')
+""" login form for login.html """
class LoginForm(FlaskForm):
email = StringField('E-Mail', validators=[ DataRequired(), Email() ])
password = PasswordField('Wachtwoord', validators=[ DataRequired() ])
@@ -29,20 +33,26 @@ class LoginForm(FlaskForm):
submit = SubmitField('Inloggen')
+""" update account form for account.html """
class UpdateAccountForm(FlaskForm):
username = StringField('Naam', validators=[ DataRequired(), Length(min=2, max=20) ])
email = StringField('E-Mail', validators=[ DataRequired(), Email() ])
+ password = PasswordField('Wachtwoord', validators=[])
+ confirm_password = PasswordField('Wachtwoord herhalen', validators=[ EqualTo('password') ])
picture = FileField('Profielfoto bewerken', validators=[ FileAllowed(['jpg', 'png']) ])
submit = SubmitField('Bewerken')
+ """ validates whether username is already in use """
def validate_username(self, username):
if username.data != current_user.username and User.query.filter_by(username=username.data).first():
raise ValidationError('Deze gebruikersnaam bestaat al, kies een andere.')
+ """ validates whether e-mail is already in use """
def validate_email(self, email):
if email.data != current_user.email and User.query.filter_by(email=email.data).first():
raise ValidationError('Deze e-mail bestaat al, log in als dat uw e-mail is')
+""" update/new course form for new_course.html """
class NewCourseForm(FlaskForm):
name = StringField('Naam', validators=[ DataRequired(), Length(min=1, max=100) ])
description = TextAreaField('Beschrijving', validators=[ DataRequired() ])
@@ -53,20 +63,23 @@ class NewCourseForm(FlaskForm):
location = StringField('Locatie', validators=[ DataRequired(), Length(min=1, max=100) ])
submit = SubmitField('Versturen')
-
+""" subscribe form for course.html """
class SubscribeForm(FlaskForm):
lang_id = HiddenField()
submit = SubmitField('Inschrijven')
+""" unsubscribe form for course.html """
class UnsubscribeForm(FlaskForm):
lang_id = HiddenField()
submit = SubmitField('Uitschrijven')
+""" search form for admin.html """
class SearchForm(FlaskForm):
username = StringField('Naam', validators=[ DataRequired(), Length(min=2, max=20)])
submit = SubmitField('Zoeken')
+""" account-settings form for admin_user.html """
class AdminForm(FlaskForm):
type = SelectField('Type', choices=[('client', 'Klant'), ('teacher', 'Docent'), ('admin', 'Administrator')])
submit = SubmitField('Bewerken')
diff --git a/pgmles/models.py b/pgmles/models.py
@@ -4,11 +4,12 @@ from flask_login import UserMixin
from .server import db, login_manager
+""" function to load a user from database """
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
-
+""" user-struct for 'user'-database """
class User(db.Model, UserMixin):
id = db.Column(db.Integer, primary_key=True)
type = db.Column(db.String(6), nullable=False, default="client")
@@ -17,10 +18,7 @@ class User(db.Model, UserMixin):
image_file = db.Column(db.String(20), nullable=False, default='default.jpg')
password = db.Column(db.String(60), nullable=False)
- def __repr__(self):
- return f"User('{self.username}', '{self.email}', '{self.image_file}')"
-
-
+""" course-struct for 'course'-database """
class Course(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False)
@@ -31,10 +29,7 @@ class Course(db.Model):
end = db.Column(db.String(10), nullable=False, default=datetime.utcnow)
location = db.Column(db.String(120), nullable=False)
- def __repr__(self):
- return f"Course('{self.id}', '{self.name}', '{self.description}')"
-
-
+""" course-member-struct for 'coursemember'-database """
class CourseMember(db.Model):
id = db.Column(db.Integer, primary_key=True)
course_id = db.Column(db.Integer, db.ForeignKey('course.id'), nullable=False)
diff --git a/pgmles/routes.py b/pgmles/routes.py
@@ -12,6 +12,7 @@ from .forms import LoginForm, NewCourseForm, AdminForm, RegistrationForm, Search
from .models import Course, CourseMember, User
+""" calendar-function to calculate days, etc. for calendar """
def make_calendar():
weekdays = list(enumerate(['Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za', 'Zo']))
@@ -29,7 +30,7 @@ def make_calendar():
return { 'weekdays': weekdays, 'rows': rows }
-
+""" index.html (home-page) route """
@app.route("/")
def index():
courses = Course.query.all()
@@ -39,13 +40,16 @@ def index():
subscriptions = [ cm.course_id for cm in CourseMember.query.filter_by(user_id=current_user.id) ]
return render_template('index.html', calendar=make_calendar(), courses=courses, subs=subscriptions, teachers=teachers)
+""" about.html route """
@app.route("/about")
def about():
return render_template('about.html', calendar=make_calendar(), title='Over ons')
+""" register.html route """
@app.route("/register", methods=['GET', 'POST'])
def register():
if current_user.is_authenticated:
+ flash('U bent al ingelogd', 'warning')
return redirect('/')
form = RegistrationForm()
if form.validate_on_submit():
@@ -57,27 +61,32 @@ def register():
return redirect(url_for('login'))
return render_template('register.html', calendar=make_calendar(), title='Registeren', form=form)
-
+""" login.html route """
@app.route("/login", methods=['GET', 'POST'])
def login():
if current_user.is_authenticated:
+ flash('U bent al ingelogd', 'warning')
return redirect('/')
form = LoginForm()
if form.validate_on_submit():
user = User.query.filter_by(email=form.email.data).first()
if user and bcrypt.check_password_hash(user.password, form.password.data):
login_user(user, remember=form.remember.data)
+ if bcrypt.check_password_hash(user.password, form.email.data):
+ flash('Wij zullen aanbevelen uw wachtwoord weer te veranderen', 'warning')
next_page = request.args.get('next')
return redirect(next_page if next_page else '/')
else:
flash('Kon niet inloggen, is uw e-mail en wachtwoord juist?', 'danger')
return render_template('login.html', calendar=make_calendar(), title='Inloggen', form=form)
+""" logout route """
@app.route("/logout")
def logout():
logout_user()
return redirect('/')
+""" save-picture function for account.html """
def save_picture(form_picture):
random_hex = secrets.token_hex(8)
_, f_ext = os.path.splitext(form_picture.filename)
@@ -91,18 +100,21 @@ def save_picture(form_picture):
return picture_fn
[email protected]("/account", methods=[ 'GET', 'POST' ])
+""" account.html route """
[email protected]("/user/self", methods=[ 'GET', 'POST' ])
@login_required
def account():
form = UpdateAccountForm()
if form.validate_on_submit():
+ current_user.username = form.username.data
+ current_user.email = form.email.data
if form.picture.data:
picture_file = save_picture(form.picture.data)
current_user.image_file = picture_file
- current_user.username = form.username.data
- current_user.email = form.email.data
+ if form.password.data:
+ current_user.password = bcrypt.generate_password_hash(form.password.data).decode('utf-8')
db.session.commit()
- flash('Uw profiel werd bewerkt!', 'success')
+ flash('Uw profiel is bewerkt!', 'success')
return redirect(url_for('account'))
elif request.method == 'GET':
form.username.data = current_user.username
@@ -110,8 +122,34 @@ def account():
image_file = url_for('static', filename='profile_pics/' + current_user.image_file)
return render_template('account.html', calendar=make_calendar(), title='Profiel', image_file=image_file, form=form)
+""" course.html (course-info) route """
[email protected]("/course/<int:course_id>", methods=[ 'GET', 'POST' ])
+def course(course_id):
+ sub_form = SubscribeForm()
+ unsub_form = UnsubscribeForm()
+ teachers = User.query.filter_by(type='teacher')
+ subscribed = None
+ if current_user.is_authenticated:
+ subscribed = CourseMember.query.filter_by(user_id=current_user.id, course_id=course_id).first()
+
+ if sub_form.validate_on_submit() and not subscribed:
+ course = CourseMember(user_id=current_user.id, course_id=course_id)
+ db.session.add(course)
+ db.session.commit()
+ flash('U bent nu ingeschreven!', 'success')
+ return redirect('/')
+
+ if unsub_form.validate_on_submit() and subscribed:
+ db.session.delete(subscribed)
+ db.session.commit()
+ flash('U bent nu uitgeschreven!', 'success')
+ return redirect('/')
+
+ course = Course.query.get_or_404(course_id)
+ return render_template('course.html', calendar=make_calendar(), title=course.name, course=course, sub_form=sub_form, unsub_form=unsub_form, subscribed=subscribed is not None, teachers=teachers)
[email protected]("/course_overview")
+""" course_overview.html route """
[email protected]("/courses")
@login_required
def course_overview():
if current_user.type not in [ "admin", "teacher" ]:
@@ -119,8 +157,8 @@ def course_overview():
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(), legend='Lesoverzicht', courses=courses)
-
[email protected]("/course_overview/new_course", methods=['GET', 'POST'])
+""" new_course.html route """
[email protected]("/course/new", methods=['GET', 'POST'])
@login_required
def new_course():
if current_user.type not in [ "admin", "teacher" ]:
@@ -135,8 +173,8 @@ def new_course():
return redirect(url_for('course_overview'))
return render_template('new_course.html', calendar=make_calendar(), legend='Nieuwe les aanmaken', form=form)
-
[email protected]("/course_overview/course_update/<int:course_id>", methods=['GET', 'POST'])
+""" new_course.html (update course) route """
[email protected]("/course/<int:course_id>/update", methods=['GET', 'POST'])
@login_required
def update_course(course_id):
if current_user.type not in [ "admin", "teacher" ]:
@@ -165,32 +203,8 @@ def update_course(course_id):
form.location.data = course.location
return render_template('new_course.html', calendar=make_calendar(), form=form, legend='Les aanpassen')
[email protected]("/course/<int:course_id>", methods=[ 'GET', 'POST' ])
-def course(course_id):
- sub_form = SubscribeForm()
- unsub_form = UnsubscribeForm()
- teachers = User.query.filter_by(type='teacher')
- subscribed = None
- if current_user.is_authenticated:
- subscribed = CourseMember.query.filter_by(user_id=current_user.id, course_id=course_id).first()
-
- if sub_form.validate_on_submit() and not subscribed:
- course = CourseMember(user_id=current_user.id, course_id=course_id)
- db.session.add(course)
- db.session.commit()
- flash('U bent nu ingeschreven!', 'success')
- return redirect('/')
-
- if unsub_form.validate_on_submit() and subscribed:
- db.session.delete(subscribed)
- db.session.commit()
- flash('U bent nu uitgeschreven!', 'success')
- return redirect('/')
-
- course = Course.query.get_or_404(course_id)
- return render_template('course.html', calendar=make_calendar(), title=course.name, course=course, sub_form=sub_form, unsub_form=unsub_form, subscribed=subscribed is not None, teachers=teachers)
-
[email protected]("/delete_course/<int:course_id>", methods=['GET','POST'])
+""" delete-course route """
[email protected]("/course/<int:course_id>/delete", methods=['GET','POST'])
@login_required
def delete_course(course_id):
if current_user.type not in [ "admin", "teacher" ]:
@@ -200,7 +214,8 @@ def delete_course(course_id):
db.session.commit()
return redirect(url_for('course_overview'))
[email protected]("/admin", methods=['GET','POST'])
+""" admin.html route """
[email protected]("/users", methods=['GET','POST'])
@login_required
def admin():
if current_user.type != "admin":
@@ -215,7 +230,8 @@ def admin():
return redirect(url_for('admin_user', user_id= user.id))
return render_template('admin.html', calendar=make_calendar(), form=form)
[email protected]("/admin/<int:user_id>", methods=['GET','POST'])
+""" account-admin route """
[email protected]("/user/<int:user_id>", methods=['GET','POST'])
@login_required
def admin_user(user_id):
if current_user.type != "admin":
@@ -231,3 +247,27 @@ def admin_user(user_id):
elif request.method == 'GET':
form.type.data = user.type
return render_template('admin_user.html', calendar=make_calendar(), form=form, user=user, image_file=image_file)
+
+""" delete-user route """
[email protected]("/user/<int:user_id>/delete", methods=['GET','POST'])
+@login_required
+def delete_user(user_id):
+ if current_user.type != "admin":
+ abort(403)
+ user = User.query.get_or_404(user_id)
+ db.session.delete(user)
+ db.session.commit()
+ flash(f'De gebruiker {user.username} werd verwijdert', 'success')
+ return redirect(url_for('admin'))
+
+""" reset user's password route """
[email protected]("/user/<int:user_id>/reset", methods=['GET','POST'])
+@login_required
+def reset_user(user_id):
+ if current_user.type != "admin":
+ abort(403)
+ user = User.query.get_or_404(user_id)
+ user.password = bcrypt.generate_password_hash(user.email).decode('utf-8')
+ db.session.commit()
+ flash(f'{user.username}\'s is nu zijn/haar e-mail', 'success')
+ return redirect(url_for('admin'))
diff --git a/pgmles/routes.txt b/pgmles/routes.txt
@@ -1,13 +0,0 @@
-/ -> index.html
-/about -> about.html
-/register -> register.html
-/login -> login.html
-/logout -> /
-/account -> account.html
-/course_overview -> course_overview.html @ teacher/admin
-/course_overview/new_course -> new_course.html / course_overview.html @ teacher/admin
-/course_overview/course_update/:id -> new_course.html / course_overview.html @ teacher/admin
-/course/:id -> / / course.html
-/delete_course/:id -> / @ teacher/admin
-/permissions -> permissions.html @ admin
-/permissions/update/:id -> updatepermissions.html / permissions.html @ admin
diff --git a/pgmles/server.py b/pgmles/server.py
@@ -12,4 +12,5 @@ login_manager = LoginManager(app)
login_manager.login_view = 'login'
login_manager.login_message_category = 'info'
+# to run 'routes.py' and make the routes available
from .routes import *
diff --git a/pgmles/templates/about.html b/pgmles/templates/about.html
@@ -1,4 +1,29 @@
{% extends "layout.html" %}
{% block content %}
- <h1>Over ons</h1>
-{% endblock content %}
+<article class="media content-section">
+ <div class="media-body">
+ <h2>Over ons</h2>
+ <p>
+ Wij staan voor educatie in Nederland! <i>IT Academy Nederland (ITAN)</i>
+ <!-- Zo heet de bedrijf in opdracht schriftelijk vaardigheden -->
+ geeft lessen aan verschillende mensen in heel Nederland, maar tot nu toe nooit aan ouderen.
+ </p>
+ <p>
+ Samen met <i>Groningen-Drenthe Systems (GDS)</i> ontwikkelden wij deze pagina om ook ouderen mogelijk te
+ maken
+ in hun vrije tijd iets nieuws te leren.
+ </p>
+ <p>
+ Vele pensioenaten waren vroeger BASIC-programmeurs, COBOL of Assembly op hun Commandore 64. Wij proberen dit
+ op te pakken en te vernieuwen met
+ moderne talen zoals Python, Java of JavaScript. Natuurlijk bieden wij ook verschillende lessen voor
+ beginners aan.
+ </p>
+ <p>
+ U bent hartelijk welkom en wij hopen u in ons lessen te kunnen zien!<br>
+ <a href="{{ url_for('register') }}">Klik hier</a>, om een profiel aan te maken en voor lessen in te
+ schrijven.
+ </p>
+ </div>
+</article>
+{% endblock content %}
+\ No newline at end of file
diff --git a/pgmles/templates/account.html b/pgmles/templates/account.html
@@ -1,57 +1,83 @@
{% extends "layout.html" %}
{% block content %}
- <div class="content-section">
- <div class="media">
+<div class="content-section">
+ <div class="media">
<img class="rounded-circle account-img" src="{{ image_file }}">
<div class="media-body">
- <h2 class="account-heading">{{ current_user.username }}</h2>
- <p class="text-secondary">{{ current_user.email }}</p>
+ <h2 class="account-heading">{{ current_user.username }}</h2>
+ <p class="text-secondary">{{ current_user.email }}</p>
</div>
- </div>
- <form method="POST" action="" enctype="multipart/form-data">
- {{ form.hidden_tag() }}
- <fieldset class="form-group">
- <legend class="border-bottom mb-4">Informatie</legend>
- <div class="form-group">
- {{ form.username.label(class="form-control-label") }}
+ </div>
+ <form method="POST" action="" enctype="multipart/form-data">
+ {{ form.hidden_tag() }}
+ <fieldset class="form-group">
+ <legend class="border-bottom mb-4">Informatie</legend>
+ <div class="form-group">
+ {{ form.username.label(class="form-control-label") }}
- {% if form.username.errors %}
- {{ form.username(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.username.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
- {% else %}
- {{ form.username(class="form-control form-control-lg") }}
- {% endif %}
+ {% if form.username.errors %}
+ {{ form.username(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.username.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
+ </div>
+ {% else %}
+ {{ form.username(class="form-control form-control-lg") }}
+ {% endif %}
+ </div>
+ <div class="form-group">
+ {{ form.email.label(class="form-control-label") }}
+ {% if form.email.errors %}
+ {{ form.email(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.email.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
</div>
- <div class="form-group">
- {{ form.email.label(class="form-control-label") }}
- {% if form.email.errors %}
- {{ form.email(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.email.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
- {% else %}
- {{ form.email(class="form-control form-control-lg") }}
- {% endif %}
+ {% else %}
+ {{ form.email(class="form-control form-control-lg") }}
+ {% endif %}
+ </div>
+ <div class="form-group">
+ {{ form.password.label(class="form-control-label") }}
+ {% if form.password.errors %}
+ {{ form.password(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.password.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
</div>
- <div class="form-group">
- {{ form.picture.label() }}
- {{ form.picture(class="form-control-file") }}
- {% if form.picture.errors %}
- {% for error in form.picture.errors %}
- <span class="text-danger">{{ error }}</span></br>
- {% endfor %}
- {% endif %}
+ {% else %}
+ {{ form.password(class="form-control form-control-lg") }}
+ {% endif %}
+ </div>
+ <div class="form-group">
+ {{ form.confirm_password.label(class="form-control-label") }}
+ {% if form.confirm_password.errors %}
+ {{ form.confirm_password(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.confirm_password.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
</div>
- </fieldset>
+ {% else %}
+ {{ form.confirm_password(class="form-control form-control-lg") }}
+ {% endif %}
+ </div>
<div class="form-group">
- {{ form.submit(class="btn btn-outline-info") }}
+ {{ form.picture.label() }}
+ {{ form.picture(class="form-control-file") }}
+ {% if form.picture.errors %}
+ {% for error in form.picture.errors %}
+ <span class="text-danger">{{ error }}</span></br>
+ {% endfor %}
+ {% endif %}
</div>
- </form>
- </div>
-{% endblock content %}
+ </fieldset>
+ <div class="form-group">
+ {{ form.submit(class="btn btn-outline-info") }}
+ </div>
+ </form>
+</div>
+{% endblock content %}
+\ No newline at end of file
diff --git a/pgmles/templates/admin.html b/pgmles/templates/admin.html
@@ -1,27 +1,27 @@
{% extends "layout.html" %}
{% block content %}
- <h1>Rechten bewerken!</h1>
- <div class="content-section">
- <form method="POST" action="">
- {{ form.hidden_tag() }}
- <fieldset class="form-group">
- <legend class="border-bottom mb-4">Zoeken</legend>
- <div class="form-group">
- {{ form.username.label(class="form-control-label") }}
- {% if form.username.errors %}
- {{ form.username(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.username.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
- {% else %}
- {{ form.username(class="form-control form-control-lg") }}
- {% endif %}
- </div>
- </fieldset>
+<h1>Rechten bewerken!</h1>
+<div class="content-section">
+ <form method="POST" action="">
+ {{ form.hidden_tag() }}
+ <fieldset class="form-group">
+ <legend class="border-bottom mb-4">Zoeken</legend>
<div class="form-group">
- {{ form.submit(class="btn btn-outline-info") }}
+ {{ form.username.label(class="form-control-label") }}
+ {% if form.username.errors %}
+ {{ form.username(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.username.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
+ </div>
+ {% else %}
+ {{ form.username(class="form-control form-control-lg") }}
+ {% endif %}
</div>
- </div>
-{% endblock content %}
+ </fieldset>
+ <div class="form-group">
+ {{ form.submit(class="btn btn-outline-info") }}
+ </div>
+</div>
+{% endblock content %}
+\ No newline at end of file
diff --git a/pgmles/templates/admin_user.html b/pgmles/templates/admin_user.html
@@ -1,32 +1,57 @@
{% extends "layout.html" %}
{% block content %}
- <div class="media">
- <img class="rounded-circle account-img" src="{{ image_file }}">
- <div class="media-body">
+<div class="media">
+ <img class="rounded-circle account-img" src="{{ image_file }}">
+ <div class="media-body">
<h2 class="account-heading">{{ user.username }}</h2>
<p class="text-secondary">{{ user.email }}</p>
+ </div>
+</div>
+<form method="POST" action="">
+ {{ form.hidden_tag() }}
+ <fieldset class="form-group">
+ <legend class="border-bottom mb-4">Rechten bewerken!</legend>
+ <div class="form-group">
+ {{ form.type.label(class="form-control-label") }}
+ {% if form.type.errors %}
+ {{ form.type(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.type.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
+ </div>
+ {% else %}
+ {{ form.type(class="form-control form-control-lg") }}
+ {% endif %}
</div>
+ </fieldset>
+ <div class="form-group">
+ <button type="button" class="btn btn-danger btn-sm m-1" data-toggle="modal"
+ data-target="#deleteModal">Verwijderen</button>
+ <a class="btn btn-danger btn-sm m-1" href="{{ url_for('reset_user', user_id=user.id) }}">Wachtwoord
+ terugzetten</a>
+ <br><br>
+ {{ form.submit(class="btn btn-outline-info") }}
</div>
- <form method="POST" action="">
- {{ form.hidden_tag() }}
- <fieldset class="form-group">
- <legend class="border-bottom mb-4">Rechten bewerken!</legend>
- <div class="form-group">
- {{ form.type.label(class="form-control-label") }}
- {% if form.type.errors %}
- {{ form.type(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.type.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
- {% else %}
- {{ form.type(class="form-control form-control-lg") }}
- {% endif %}
+</form>
+<!-- Modal -->
+<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel"
+ aria-hidden="true">
+ <div class="modal-dialog" role="document">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h5 class="modal-title" id="deleteModalLabel">Profiel verwijderen?</h5>
+ <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+ <span aria-hidden="true">×</span>
+ </button>
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-secondary" data-dismiss="modal">Sluiten</button>
+ <form action="{{ url_for('delete_user', user_id=user.id) }}" method="POST">
+ <input class="btn btn-danger" type="submit" value="Delete">
+ </form>
</div>
- </fieldset>
- <div class="form-group">
- {{ form.submit(class="btn btn-outline-info") }}
</div>
- </form>
+ </div>
+</div>
{% endblock content %}
\ No newline at end of file
diff --git a/pgmles/templates/course.html b/pgmles/templates/course.html
@@ -1,35 +1,37 @@
{% extends "layout.html" %}
{% block content %}
- <article class="media content-section">
- <div class="media-body">
- <h2><a class="article-title" href="{{url_for('course', course_id=course.id)}}">
- {{ course.name }}
- {{ '(subscribed)' if course.id in subs }}
+<article class="media content-section">
+ <div class="media-body">
+ <h2><a class="article-title" href="{{url_for('course', course_id=course.id)}}">
+ {{ course.name }}
+ {{ '(subscribed)' if course.id in subs }}
</a></h2>
- <p><i>{{ course.description }}</i></p>
- <p>wordt gegeven door {% for teacher in teachers if teacher.id == course.teacher_id %}{{ teacher.username }},{% endfor %}</p>
- <p>elke {{ ['maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag', 'zondag'][course.weekday] }} {{ course.start }} uur t/m {{ course.end }} uur op locatie: <b>{{ course.location }}</b></p>
- </div>
- <div class="article-metadata">
- {% if current_user.is_authenticated %}
- {% if not subscribed %}
- <form method="POST" action="">
- {{ sub_form.hidden_tag() }}
- <div class="form-group">
- {{ sub_form.submit(class="btn btn-outline-info") }}
- </div>
- </form>
- {% else %}
- <form method="POST" action="">
- {{ unsub_form.hidden_tag() }}
- <div class="form-group">
- {{ unsub_form.submit(class="btn btn-outline-info") }}
- </div>
- </form>
- {%endif%}
- {% else %}
- <p><a href="{{ url_for('login') }}">Inloggen om in te schrijven</a></p>
- {% endif %}
- </div>
- </article>
-{% endblock content %}
+ <p><i>{{ course.description }}</i></p>
+ <p>wordt gegeven door {% for teacher in teachers if teacher.id == course.teacher_id %}{{ teacher.username }},{%
+ endfor %}</p>
+ <p>elke {{ ['maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag', 'zondag'][course.weekday] }}
+ {{ course.start }} uur t/m {{ course.end }} uur op locatie: <b>{{ course.location }}</b></p>
+ </div>
+ <div class="article-metadata">
+ {% if current_user.is_authenticated %}
+ {% if not subscribed %}
+ <form method="POST" action="">
+ {{ sub_form.hidden_tag() }}
+ <div class="form-group">
+ {{ sub_form.submit(class="btn btn-outline-info") }}
+ </div>
+ </form>
+ {% else %}
+ <form method="POST" action="">
+ {{ unsub_form.hidden_tag() }}
+ <div class="form-group">
+ {{ unsub_form.submit(class="btn btn-outline-info") }}
+ </div>
+ </form>
+ {%endif%}
+ {% else %}
+ <p><a href="{{ url_for('login') }}">Inloggen om in te schrijven</a></p>
+ {% endif %}
+ </div>
+</article>
+{% endblock content %}
+\ No newline at end of file
diff --git a/pgmles/templates/course_overview.html b/pgmles/templates/course_overview.html
@@ -13,15 +13,17 @@
{% for course, teacher in courses %}
<article class="media content-section">
<div class="media-body">
- <h2><a class="article-title" href="{{url_for('course', course_id=course.id)}}">{{course.name}} <small>by {{ teacher.username }}</small></a></h2>
+ <h2><a class="article-title" href="{{url_for('course', course_id=course.id)}}">{{course.name}} <small>by {{
+ teacher.username }}</small></a></h2>
<div>
<a class="btn btn-secondary btn-sm mt-1 mb-1" href="{{ url_for('update_course', course_id = course.id) }}">Bewerken</a>
<button type="button" class="btn btn-danger btn-sm m-1" data-toggle="modal" data-target="#deleteModal">Verwijderen</button>
</div>
</div>
</article>
- <!-- Modal -->
-<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel" aria-hidden="true">
+<!-- Modal -->
+<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="deleteModalLabel"
+ aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
@@ -40,4 +42,4 @@
</div>
</div>
{% endfor %}
-{% endblock content %}
+{% endblock content %}
+\ No newline at end of file
diff --git a/pgmles/templates/index.html b/pgmles/templates/index.html
@@ -1,16 +1,32 @@
{% extends "layout.html" %}
{% block content %}
- {% for course in courses %}
- <article class="media content-section">
- <div class="media-body">
- <h2><a class="article-title" href="{{url_for('course', course_id=course.id)}}">
- {{ course.name }}
- {{ '(subscribed)' if course.id in subs }}
- </a></h2>
- <p><i>{{ course.description }}</i></p>
- <p>wordt gegeven door {% for teacher in teachers if teacher.id == course.teacher_id %}{{ teacher.username }},{% endfor %}</p>
- <p>elke {{ ['maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag', 'zondag'][course.weekday] }} {{ course.start }} uur t/m {{ course.end }} uur op locatie: <b>{{ course.location }}</b></p>
- </div>
- </article>
- {% endfor %}
-{% endblock content %}
+<article class="media content-section">
+ <div class="media-body">
+ <h2>Dit zijn ons lessen</h2>
+ <p>
+ U kan makkelijk op de titel van een les klikken om in te schrijven!
+ </p>
+ </div>
+</article>
+{% for course in courses %}
+<article class="media content-section">
+ <div class="media-body">
+ <h3><a class="article-title" href="{{url_for('course', course_id=course.id)}}">
+ {{ course.name }}
+ {{ '(subscribed)' if course.id in subs }}
+ </a></h3>
+ <p><i>{{ course.description }}</i></p>
+ <p>
+ wordt gegeven door
+ {% for teacher in teachers if teacher.id == course.teacher_id %}
+ {{ teacher.username }},
+ {% endfor %}
+ </p>
+ <p>
+ elke {{ ['maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag', 'zondag'][course.weekday] }}
+ {{ course.start }} uur t/m {{ course.end }} uur op locatie: <b>{{ course.location }}</b>
+ </p>
+ </div>
+</article>
+{% endfor %}
+{% endblock content %}
+\ No newline at end of file
diff --git a/pgmles/templates/layout.html b/pgmles/templates/layout.html
@@ -1,96 +1,110 @@
<!DOCTYPE html>
<html>
+
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
+ integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='main.css') }}">
{% if title %}
- <title>Programmeerles voor ouderen - {{ title }}</title>
+ <title>Programmeerles voor ouderen - {{ title }}</title>
{% else %}
- <title>Programmeerles voor ouderen</title>
+ <title>Programmeerles voor ouderen</title>
{% endif %}
</head>
+
<body>
<header class="site-header">
- <nav class="navbar navbar-expand-md navbar-dark bg-steel fixed-top">
- <div class="container">
- <a class="navbar-brand mr-4" href="/">Programmeerles voor ouderen</a>
- <div class="collapse navbar-collapse" id="navbarToggle">
- <div class="navbar-nav mr-auto">
- <a class="nav-item nav-link" href="/about">Over ons</a>
- </div>
- <!-- Navbar Right Side -->
- <div class="navbar-nav">
- {% if current_user.is_authenticated %}
- <a class="nav-item nav-link" href="{{ url_for('account') }}">Profiel</a>
- <a class="nav-item nav-link" href="{{ url_for('logout') }}">Uitloggen</a>
- {% else %}
- <a class="nav-item nav-link" href="{{ url_for('login') }}">Inloggen</a>
- <a class="nav-item nav-link" href="{{ url_for('register') }}">Registeren</a>
- {% endif %}
+ <nav class="navbar navbar-expand-md navbar-dark bg-steel fixed-top">
+ <div class="container">
+ <a class="navbar-brand mr-4" href="/">Programmeerles voor ouderen</a>
+ <div class="collapse navbar-collapse" id="navbarToggle">
+ <div class="navbar-nav mr-auto">
+ <a class="nav-item nav-link" href="/about">Over ons</a>
+ </div>
+ <!-- Navbar Right Side -->
+ <div class="navbar-nav">
+ {% if current_user.is_authenticated %}
+ <a class="nav-item nav-link" href="{{ url_for('logout') }}">Uitloggen</a>
+ {% else %}
+ <a class="nav-item nav-link" href="{{ url_for('login') }}">Inloggen</a>
+ <a class="nav-item nav-link" href="{{ url_for('register') }}">Registeren</a>
+ {% endif %}
+ </div>
+ </div>
</div>
- </div>
- </div>
- </nav>
+ </nav>
</header>
<main role="main" class="container">
- <div class="row">
- <div class="col-md-8">
- {% with messages = get_flashed_messages(with_categories=true) %}
- {% if messages %}
- {% for category, message in messages %}
+ <div class="row">
+ <div class="col-md-8">
+ {% with messages = get_flashed_messages(with_categories=true) %}
+ {% if messages %}
+ {% for category, message in messages %}
<div class="alert alert-{{ category }}">
- {{ message }}
+ {{ message }}
</div>
- {% endfor %}
- {% endif %}
- {% endwith %}
- {% block content %}{% endblock %}
- </div>
- <div class="col-md-4">
- <div class="content-section">
- <h3>Welkom <b>{{ current_user.username if current_user.is_authenticated else 'gast' }}</b>!</h3>
- {% if current_user.type == 'teacher' or current_user.type == 'admin' %}
- <p class='text-muted'>
- <ul class="list-group">
- <li class="list-group-item list-group-item-light"><a href="{{ url_for('course_overview') }}">Lesoverzicht</a></li>
- {% if current_user.type == 'admin' %}
- <li class="list-group-item list-group-item-light"><a href="{{ url_for('admin') }}">Rechten bewerken</a></li>
- {% endif %}
- </ul>
- </p>
- {% endif %}
- <table class='calendar'>
- <tr>
- {% for d, day in calendar['weekdays'] %}
- <th class="{{ 'weekend' if d >= 5 }}">{{ day }}</th>
{% endfor %}
- </tr>
- {% for row in calendar['rows'] %}
- <tr>
- {% for d, day, course in row %}
- <td class="{{ 'weekend' if d >= 5 }} {{ 'course' if course and day }}">
- {{ day if day }}
- {% if course %}<span class='hover-day'>{{ course }}</span>{% endif %}
- </td>
- {% endfor %}
- </tr>
- {% endfor %}
- </table>
- </div>
+ {% endif %}
+ {% endwith %}
+ {% block content %}{% endblock %}
+ </div>
+ <div class="col-md-4">
+ <div class="content-section">
+ <h3>Welkom <b>{{ current_user.username if current_user.is_authenticated else 'gast' }}</b>!</h3>
+ {% if current_user.is_authenticated %}
+ <p class='text-muted'>
+ <ul class="list-group">
+ <li class="list-group-item list-group-item-light"><a
+ href="{{ url_for('account') }}">Instellingen</a></li>
+ {% if current_user.type == 'teacher' or current_user.type == 'admin' %}
+ <li class="list-group-item list-group-item-light"><a
+ href="{{ url_for('course_overview') }}">Lesoverzicht</a></li>
+ {% endif %}
+ {% if current_user.type == 'admin' %}
+ <li class="list-group-item list-group-item-light"><a href="{{ url_for('admin') }}">Profielen
+ bewerken</a></li>
+ {% endif %}
+ </ul>
+ </p>
+ {% endif %}
+ <table class='calendar'>
+ <tr>
+ {% for d, day in calendar['weekdays'] %}
+ <th class="{{ 'weekend' if d >= 5 }}">{{ day }}</th>
+ {% endfor %}
+ </tr>
+ {% for row in calendar['rows'] %}
+ <tr>
+ {% for d, day, course in row %}
+ <td class="{{ 'weekend' if d >= 5 }} {{ 'course' if course and day }}">
+ {{ day if day }}
+ {% if course %}<span class='hover-day'>{{ course }}</span>{% endif %}
+ </td>
+ {% endfor %}
+ </tr>
+ {% endfor %}
+ </table>
+ </div>
+ </div>
</div>
- </div>
</main>
-
- <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
+ <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
+ integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
+ crossorigin="anonymous"></script>
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
+ integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
+ crossorigin="anonymous"></script>
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
+ integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
+ crossorigin="anonymous"></script>
</body>
-</html>
+
+</html>
+\ No newline at end of file
diff --git a/pgmles/templates/login.html b/pgmles/templates/login.html
@@ -1,52 +1,52 @@
{% extends "layout.html" %}
{% block content %}
- <div class="content-section">
- <form method="POST" action="">
- {{ form.hidden_tag() }}
- <fieldset class="form-group">
- <legend class="border-bottom mb-4">Inloggen</legend>
- <div class="form-group">
- {{ form.email.label(class="form-control-label") }}
- {% if form.email.errors %}
- {{ form.email(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.email.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
- {% else %}
- {{ form.email(class="form-control form-control-lg") }}
- {% endif %}
- </div>
- <div class="form-group">
- {{ form.password.label(class="form-control-label") }}
- {% if form.password.errors %}
- {{ form.password(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.password.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
- {% else %}
- {{ form.password(class="form-control form-control-lg") }}
- {% endif %}
- </div>
- <div class="form-check">
- {{ form.remember(class="form-check-input") }}
- {{ form.remember.label(class="form-check-label") }}
+<div class="content-section">
+ <form method="POST" action="">
+ {{ form.hidden_tag() }}
+ <fieldset class="form-group">
+ <legend class="border-bottom mb-4">Inloggen</legend>
+ <div class="form-group">
+ {{ form.email.label(class="form-control-label") }}
+ {% if form.email.errors %}
+ {{ form.email(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.email.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
</div>
- </fieldset>
+ {% else %}
+ {{ form.email(class="form-control form-control-lg") }}
+ {% endif %}
+ </div>
<div class="form-group">
- {{ form.submit(class="btn btn-outline-info") }}
+ {{ form.password.label(class="form-control-label") }}
+ {% if form.password.errors %}
+ {{ form.password(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.password.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
+ </div>
+ {% else %}
+ {{ form.password(class="form-control form-control-lg") }}
+ {% endif %}
+ </div>
+ <div class="form-check">
+ {{ form.remember(class="form-check-input") }}
+ {{ form.remember.label(class="form-check-label") }}
</div>
- <small class="text-muted ml-2">
- <a href="#">Wachtwoord vergeten?</a>
- </small>
- </form>
- </div>
- <div class="border-top pt-3">
- <small class="text-muted">
- Een profiel nodig? <a class="ml-2" href="{{ url_for('register') }}">Nu inschrijven!</a>
+ </fieldset>
+ <div class="form-group">
+ {{ form.submit(class="btn btn-outline-info") }}
+ </div>
+ <small class="text-muted ml-2">
+ Wachtwoord vergeten? Neem contact met een administrator.
</small>
- </div>
-{% endblock content %}
+ </form>
+</div>
+<div class="border-top pt-3">
+ <small class="text-muted">
+ Een profiel nodig? <a class="ml-2" href="{{ url_for('register') }}">Nu inschrijven!</a>
+ </small>
+</div>
+{% endblock content %}
+\ No newline at end of file
diff --git a/pgmles/templates/new_course.html b/pgmles/templates/new_course.html
@@ -8,92 +8,92 @@
<div class="form-group">
{{ form.name.label(class="form-control-label") }}
{% if form.name.errors %}
- {{ form.name(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.name.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
+ {{ form.name(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.name.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
+ </div>
{% else %}
- {{ form.name(class="form-control form-control-lg") }}
+ {{ form.name(class="form-control form-control-lg") }}
{% endif %}
</div>
<div class="form-group">
{{ form.description.label(class="form-control-label") }}
{% if form.description.errors %}
- {{ form.description(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.description.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
+ {{ form.description(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.description.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
+ </div>
{% else %}
- {{ form.description(class="form-control form-control-lg") }}
+ {{ form.description(class="form-control form-control-lg") }}
{% endif %}
</div>
- <div class="form-group">
+ <div class="form-group">
{{ form.teacher_id.label(class="form-control-label") }}
{% if form.teacher_id.errors %}
{{ form.teacher_id(class="form-control form-control-lg is-invalid") }}
<div class="invalid-feedback">
{% for error in form.teacher_id.errors %}
- <span>{{ error }}</span>
+ <span>{{ error }}</span>
{% endfor %}
</div>
{% else %}
{{ form.teacher_id(class="form-control form-control-lg") }}
- {% endif %}
+ {% endif %}
</div>
<div class="form-group">
{{ form.weekday.label(class="form-control-label") }}
{% if form.weekday.errors %}
- {{ form.weekday(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.weekday.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
+ {{ form.weekday(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.weekday.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
+ </div>
{% else %}
- {{ form.weekday(class="form-control form-control-lg") }}
+ {{ form.weekday(class="form-control form-control-lg") }}
{% endif %}
</div>
<div class="form-group">
{{ form.start.label(class="form-control-label") }}
{% if form.start.errors %}
- {{ form.start(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.start.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
+ {{ form.start(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.start.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
+ </div>
{% else %}
- {{ form.start(class="form-control form-control-lg") }}
+ {{ form.start(class="form-control form-control-lg") }}
{% endif %}
</div>
<div class="form-group">
{{ form.end.label(class="form-control-label") }}
{% if form.end.errors %}
- {{ form.end(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.end.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
+ {{ form.end(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.end.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
+ </div>
{% else %}
- {{ form.end(class="form-control form-control-lg") }}
+ {{ form.end(class="form-control form-control-lg") }}
{% endif %}
</div>
<div class="form-group">
{{ form.location.label(class="form-control-label") }}
{% if form.location.errors %}
- {{ form.location(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.location.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
+ {{ form.location(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.location.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
+ </div>
{% else %}
- {{ form.location(class="form-control form-control-lg") }}
+ {{ form.location(class="form-control form-control-lg") }}
{% endif %}
</div>
</fieldset>
@@ -102,4 +102,4 @@
</div>
</form>
</div>
-{% endblock content %}
+{% endblock content %}
+\ No newline at end of file
diff --git a/pgmles/templates/register.html b/pgmles/templates/register.html
@@ -1,70 +1,71 @@
{% extends "layout.html" %}
{% block content %}
- <div class="content-section">
- <form method="POST" action="">
- {{ form.hidden_tag() }}
- <fieldset class="form-group">
- <legend class="border-bottom mb-4">Nog vandaag meedoen!</legend>
- <div class="form-group">
- {{ form.username.label(class="form-control-label") }}
+<div class="content-section">
+ <form method="POST" action="">
+ {{ form.hidden_tag() }}
+ <fieldset class="form-group">
+ <legend class="border-bottom mb-4">Nog vandaag meedoen!</legend>
+ <div class="form-group">
+ {{ form.username.label(class="form-control-label") }}
- {% if form.username.errors %}
- {{ form.username(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.username.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
- {% else %}
- {{ form.username(class="form-control form-control-lg") }}
- {% endif %}
- </div>
- <div class="form-group">
- {{ form.email.label(class="form-control-label") }}
- {% if form.email.errors %}
- {{ form.email(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.email.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
- {% else %}
- {{ form.email(class="form-control form-control-lg") }}
- {% endif %}
+ {% if form.username.errors %}
+ {{ form.username(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.username.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
</div>
- <div class="form-group">
- {{ form.password.label(class="form-control-label") }}
- {% if form.password.errors %}
- {{ form.password(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.password.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
- {% else %}
- {{ form.password(class="form-control form-control-lg") }}
- {% endif %}
+ {% else %}
+ {{ form.username(class="form-control form-control-lg") }}
+ {% endif %}
+ </div>
+ <div class="form-group">
+ {{ form.email.label(class="form-control-label") }}
+ {% if form.email.errors %}
+ {{ form.email(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.email.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
</div>
- <div class="form-group">
- {{ form.confirm_password.label(class="form-control-label") }}
- {% if form.confirm_password.errors %}
- {{ form.confirm_password(class="form-control form-control-lg is-invalid") }}
- <div class="invalid-feedback">
- {% for error in form.confirm_password.errors %}
- <span>{{ error }}</span>
- {% endfor %}
- </div>
- {% else %}
- {{ form.confirm_password(class="form-control form-control-lg") }}
- {% endif %}
+ {% else %}
+ {{ form.email(class="form-control form-control-lg") }}
+ {% endif %}
+ </div>
+ <div class="form-group">
+ {{ form.password.label(class="form-control-label") }}
+ {% if form.password.errors %}
+ {{ form.password(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.password.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
</div>
- </fieldset>
+ {% else %}
+ {{ form.password(class="form-control form-control-lg") }}
+ {% endif %}
+ </div>
<div class="form-group">
- {{ form.submit(class="btn btn-outline-info") }}
+ {{ form.confirm_password.label(class="form-control-label") }}
+ {% if form.confirm_password.errors %}
+ {{ form.confirm_password(class="form-control form-control-lg is-invalid") }}
+ <div class="invalid-feedback">
+ {% for error in form.confirm_password.errors %}
+ <span>{{ error }}</span>
+ {% endfor %}
+ </div>
+ {% else %}
+ {{ form.confirm_password(class="form-control form-control-lg") }}
+ {% endif %}
</div>
- </form>
- </div>
- <div class="border-top pt-3">
- <small class="text-muted">Heb jij al een account? <a class="ml-2" href="{{ url_for('login') }}">Inloggen!</a></small>
- </div>
-{% endblock content %}
+ </fieldset>
+ <div class="form-group">
+ {{ form.submit(class="btn btn-outline-info") }}
+ </div>
+ </form>
+</div>
+<div class="border-top pt-3">
+ <small class="text-muted">Heb jij al een account? <a class="ml-2"
+ href="{{ url_for('login') }}">Inloggen!</a></small>
+</div>
+{% endblock content %}
+\ No newline at end of file
diff --git a/readme.md b/readme.md
@@ -1,3 +1,50 @@
-```pip3 install flask wtforms flask_sqlalchemy flask-wtf email_validator flask-bcrypt flask-login pillow```
+# PROGRAMMEERLES VOOR OUDEREN
-```python3 run.py```
-\ No newline at end of file
+## De server runnen
+
+Dit is een dev-server, dus run je met `debug=True`-flag!
+
+**Alle afhankelijkheden installeren:**
+```
+$ pip3 install flask wtforms flask_sqlalchemy flask-wtf email_validator flask-bcrypt flask-login pillow
+```
+
+**De server runnen:**
+```
+$ python run.py
+```
+
+## Uitleg
+
+| route | bestand | beschrikbaar als<sup>1</sup> | beschrijving |
+|-----------------------------|----------------------|------------------------------|----------------------------------------------------------|
+| / | index.html | gast | home-pagina |
+| /about | about.html | gast | over ons |
+| /register | register.html | gast | registeren van een gebruiker<sup>2</sup> |
+| /login | login.html | gast | inloggen van een gebruiker<sup>2,3</sup> |
+| /logout | *redirect: /* | klant | uitloggen van een gebruiker |
+| /courses | course_overview.html | docent | lessen bewerken/verwijderen |
+| /course/new | new_course.html | docent | nieuwe les aanmaken |
+| /course/`:course_id` | course.html | klant | les informatie |
+| /course/`:course_id`/update | new_course.html | docent | les instellingen |
+| /course/`:course_id`/delete | *redirect: /courses* | docent | les verwijderen |
+| /users | admin.html | admin | gebruiker overzicht<sup>4</sup> |
+| /user/self | account.html | klant | profiel instellingen |
+| /user/`:user_id` | admin_user.html | admin | gebruiker instellingen |
+| /user/`:user_id`/delete | *redirect: /users* | admin | gebruiker verwijderen |
+| /user/`:user_id`/reset | *redirect: /users* | admin | gebruikers wachtwoord terugzetten<sup>5</sup> |
+|-----------------------------|----------------------|------------------------------|----------------------------------------------------------|
+| | layout.html | | de basis layout voor alle routen |
+| | static/main.css | | de basis stylesheet voor alle routen |
+| | static/profile_pics | | map met alle profielfoto's inclusief default profielfoto |
+
+> <sup>1</sup> de hierachie is: gast (niet ingelogd), klant, docent, admin<br>
+> dus kan een gast het minste bereiken, een klant ook kan alles bereiken wat gast mag etc.
+
+> <sup>2</sup> als hij al ingelogd is, wordt weer naar `/` redirect
+
+> <sup>3</sup> jij kan een `?next=` parameters geven, dan wordt na het inloggen daarheen redirect
+
+> <sup>4</sup> bij gebruiker zoeken moet de naam overeinkomen met de gebruikers naam, nog geen echte zoek-functie
+
+> <sup>5</sup> betekent: zijn wachtwoord is dan gelijk aan zijn e-mail om in te loggen en zijn wachtwoord weer te veranderen, als iemand zijn wachtwoord is vergeten