mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-15 01:05:42 +00:00
23 lines
690 B
Python
23 lines
690 B
Python
from flask import render_template
|
|
from ..models import User
|
|
from ..tables import AdminUserTable, AdminUserItem
|
|
from . import main
|
|
from ..decorators import admin_required
|
|
from flask_login import login_required
|
|
|
|
|
|
@main.route('/')
|
|
def index():
|
|
return render_template('main/index.html.j2', title='Portal')
|
|
|
|
|
|
@main.route('/admin')
|
|
@login_required
|
|
@admin_required
|
|
def for_admins_only():
|
|
users = User.query.order_by(User.username).all()
|
|
items = [AdminUserItem(u.username, u.email, u.role_id, u.confirmed) for u in users]
|
|
table = AdminUserTable(items)
|
|
return render_template('main/admin.html.j2', title='Administration Tools',
|
|
table=table.__html__())
|