diff --git a/advlabdb/adminModelViews.py b/advlabdb/adminModelViews.py index b7261e8..ad11c87 100644 --- a/advlabdb/adminModelViews.py +++ b/advlabdb/adminModelViews.py @@ -1,18 +1,19 @@ from flask import flash, request, url_for +from flask_admin.contrib.sqla.fields import QuerySelectField, QuerySelectMultipleField from flask_admin.contrib.sqla.filters import BaseSQLAFilter +from flask_admin.helpers import get_form_data from flask_admin.menu import MenuLink from flask_admin.model.template import EndpointLinkRowAction -from flask_security import current_user, hash_password, admin_change_password +from flask_security import admin_change_password, current_user, hash_password from sqlalchemy import func, or_ -from wtforms import Form, BooleanField, SelectField, TextField, RadioField -from wtforms.validators import DataRequired, Email, Optional, URL -from flask_admin.contrib.sqla.fields import QuerySelectMultipleField, QuerySelectField -from flask_admin.helpers import get_form_data +from wtforms import BooleanField, Form, RadioField, SelectField, TextField from wtforms.fields.html5 import DateField +from wtforms.validators import URL, DataRequired, Email, Optional from advlabdb import adminSpace, app, db, user_datastore from advlabdb.configUtils import getConfig from advlabdb.customClasses import SecureAdminModelView +from advlabdb.exceptions import DataBaseException, ModelViewException from advlabdb.models import ( Appointment, Assistant, @@ -21,20 +22,15 @@ from advlabdb.models import ( Group, GroupExperiment, Part, - SemesterExperiment, PartStudent, + Program, Role, Semester, + SemesterExperiment, Student, User, - Program, ) -from advlabdb.utils import ( - randomPassword, - setUserActiveSemester, - userActiveSemester, -) -from advlabdb.exceptions import ModelViewException, DataBaseException +from advlabdb.utils import randomPassword, setUserActiveSemester, userActiveSemester class UserView(SecureAdminModelView): diff --git a/advlabdb/assistantModelViews.py b/advlabdb/assistantModelViews.py index 55f2e2d..b056e40 100644 --- a/advlabdb/assistantModelViews.py +++ b/advlabdb/assistantModelViews.py @@ -2,6 +2,7 @@ from flask_security import current_user from advlabdb import assistantSpace, db from advlabdb.customClasses import SecureAssistantModelView +from advlabdb.exceptions import DataBaseException, ModelViewException from advlabdb.models import ( Appointment, Assistant, @@ -10,16 +11,15 @@ from advlabdb.models import ( Group, GroupExperiment, Part, - SemesterExperiment, PartStudent, + Program, Role, Semester, + SemesterExperiment, Student, User, - Program, ) from advlabdb.utils import userActiveSemester -from advlabdb.exceptions import ModelViewException, DataBaseException class AssistantGroupExperimentView(SecureAssistantModelView): diff --git a/advlabdb/customClasses.py b/advlabdb/customClasses.py index 79b859b..f2fc335 100644 --- a/advlabdb/customClasses.py +++ b/advlabdb/customClasses.py @@ -1,9 +1,9 @@ +from flask import flash, redirect, request, url_for from flask_admin import AdminIndexView from flask_admin.contrib.sqla import ModelView from flask_security import current_user -from flask import redirect, request, url_for, flash -from advlabdb.exceptions import ModelViewException, DataBaseException +from advlabdb.exceptions import DataBaseException, ModelViewException def adminViewIsAccessible(): diff --git a/advlabdb/routes.py b/advlabdb/routes.py index 4d752ac..80f1b07 100644 --- a/advlabdb/routes.py +++ b/advlabdb/routes.py @@ -1,4 +1,4 @@ -from flask import redirect, render_template, request, url_for, flash +from flask import flash, redirect, render_template, request, url_for from flask_security import auth_required, current_user from advlabdb import app diff --git a/poetry.lock b/poetry.lock index b4919ac..5b55d6d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -225,7 +225,7 @@ python-versions = ">=3.5" [[package]] name = "isort" -version = "5.9.2" +version = "5.9.3" description = "A Python utility / library to sort Python imports." category = "dev" optional = false @@ -373,7 +373,7 @@ sqlcipher = ["sqlcipher3-binary"] [[package]] name = "tomli" -version = "1.1.0" +version = "1.2.0" description = "A lil' TOML parser" category = "dev" optional = false @@ -525,8 +525,8 @@ idna = [ {file = "idna-3.2.tar.gz", hash = "sha256:467fbad99067910785144ce333826c71fb0e63a425657295239737f7ecd125f3"}, ] isort = [ - {file = "isort-5.9.2-py3-none-any.whl", hash = "sha256:eed17b53c3e7912425579853d078a0832820f023191561fcee9d7cae424e0813"}, - {file = "isort-5.9.2.tar.gz", hash = "sha256:f65ce5bd4cbc6abdfbe29afc2f0245538ab358c14590912df638033f157d555e"}, + {file = "isort-5.9.3-py3-none-any.whl", hash = "sha256:e17d6e2b81095c9db0a03a8025a957f334d6ea30b26f9ec70805411e5c7c81f2"}, + {file = "isort-5.9.3.tar.gz", hash = "sha256:9c2ea1e62d871267b78307fe511c0838ba0da28698c5732d54e2790bf3ba9899"}, ] itsdangerous = [ {file = "itsdangerous-2.0.1-py3-none-any.whl", hash = "sha256:5174094b9637652bdb841a3029700391451bd092ba3db90600dea710ba28e97c"}, @@ -675,8 +675,8 @@ sqlalchemy = [ {file = "SQLAlchemy-1.4.22.tar.gz", hash = "sha256:ec1be26cdccd60d180359a527d5980d959a26269a2c7b1b327a1eea0cab37ed8"}, ] tomli = [ - {file = "tomli-1.1.0-py3-none-any.whl", hash = "sha256:f4a182048010e89cbec0ae4686b21f550a7f2903f665e34a6de58ec15424f919"}, - {file = "tomli-1.1.0.tar.gz", hash = "sha256:33d7984738f8bb699c9b0a816eb646a8178a69eaa792d258486776a5d21b8ca5"}, + {file = "tomli-1.2.0-py3-none-any.whl", hash = "sha256:056f0376bf5a6b182c513f9582c1e5b0487265eb6c48842b69aa9ca1cd5f640a"}, + {file = "tomli-1.2.0.tar.gz", hash = "sha256:d60e681734099207a6add7a10326bc2ddd1fdc36c1b0f547d00ef73ac63739c2"}, ] werkzeug = [ {file = "Werkzeug-2.0.1-py3-none-any.whl", hash = "sha256:6c1ec500dcdba0baa27600f6a22f6333d8b662d22027ff9f6202e3367413caa8"},