33 lines
732 B
Python
33 lines
732 B
Python
from flask import abort, render_template
|
|
from flask_login import current_user, login_required
|
|
|
|
from . import site
|
|
|
|
|
|
@site.route('/')
|
|
def homepage():
|
|
"""
|
|
Render the homepage template on the / route
|
|
"""
|
|
return render_template('site/index.html', title="Welcome")
|
|
|
|
|
|
@site.route('/dashboard')
|
|
@login_required
|
|
def dashboard():
|
|
"""
|
|
Render the dashboard template on the /dashboard route
|
|
"""
|
|
return render_template('home/dashboard.html', title="Dashboard")
|
|
|
|
|
|
@site.route('/admin/dashboard')
|
|
@login_required
|
|
def admin_dashboard():
|
|
# prevent non-admins from accessing the page
|
|
if not current_user.is_admin:
|
|
abort(403)
|
|
|
|
return render_template('home/admin_dashboard.html', title="Dashboard")
|
|
|