diff --git a/advlabdb/adminModelViews.py b/advlabdb/adminModelViews.py index 8d0e52f..f43b1b7 100644 --- a/advlabdb/adminModelViews.py +++ b/advlabdb/adminModelViews.py @@ -1,6 +1,6 @@ from pathlib import Path -from flask import flash, redirect, request, url_for, has_request_context +from flask import flash, has_request_context, redirect, request, url_for from flask_admin import expose from flask_admin.contrib.sqla.fields import QuerySelectField, QuerySelectMultipleField from flask_admin.contrib.sqla.filters import FilterEqual @@ -26,10 +26,15 @@ from wtforms.validators import URL, DataRequired, Email, NumberRange, Optional from advlabdb import adminSpace, app, assistantSpace, db, user_datastore from advlabdb.configUtils import getConfig -from advlabdb.customClasses import SecureAdminBaseView, SecureAdminModelView, CustomIdEndpointLinkRowAction +from advlabdb.customClasses import ( + CustomIdEndpointLinkRowAction, + SecureAdminBaseView, + SecureAdminModelView, +) from advlabdb.database_import import importFromFile from advlabdb.exceptions import DataBaseException, ModelViewException from advlabdb.models import ( + Admin, Appointment, Assistant, Experiment, @@ -44,7 +49,6 @@ from advlabdb.models import ( SemesterExperiment, Student, User, - Admin, ) from advlabdb.utils import ( flashRandomPassword, @@ -1368,7 +1372,7 @@ class ImportView(SecureAdminBaseView): class DocsView(SecureAdminBaseView): - @expose() + @expose("/") def index(self): return self.render("docs/admin.html") diff --git a/advlabdb/assistantModelViews.py b/advlabdb/assistantModelViews.py index 15f8264..fe1bbe5 100644 --- a/advlabdb/assistantModelViews.py +++ b/advlabdb/assistantModelViews.py @@ -179,7 +179,7 @@ class AssistantUserView(SecureAssistantModelView): class AssistantDocsView(SecureAssistantBaseView): - @expose() + @expose("/") def index(self): return self.render("docs/assistant.html") diff --git a/advlabdb/customClasses.py b/advlabdb/customClasses.py index 00ec0c7..606674d 100644 --- a/advlabdb/customClasses.py +++ b/advlabdb/customClasses.py @@ -1,6 +1,7 @@ from flask import flash, redirect, request, url_for from flask_admin import AdminIndexView, BaseView, expose from flask_admin.contrib.sqla import ModelView +from flask_admin.model.template import EndpointLinkRowAction from flask_security import current_user from sqlalchemy import and_ @@ -14,7 +15,6 @@ from advlabdb.models import ( SemesterExperiment, ) from advlabdb.utils import reportBadAttempt, userActiveSemester -from flask_admin.model.template import EndpointLinkRowAction def adminViewIsAccessible(): @@ -35,7 +35,7 @@ class SecureAdminIndexView(CustomIndexView): def is_accessible(self): return adminViewIsAccessible() - @expose() + @expose("/") def index(self): active_semester_experiment_marks_query = ExperimentMark.query.filter( ExperimentMark.part_student.has(PartStudent.part.has(Part.semester == userActiveSemester())) @@ -58,7 +58,7 @@ class SecureAssistantIndexView(CustomIndexView): def is_accessible(self): return assistantViewIsAccessible() - @expose() + @expose("/") def index(self): active_semester_experiment_marks_query = ExperimentMark.query.filter( ExperimentMark.group_experiment.has(