1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-20 23:41:20 +00:00
This commit is contained in:
Mo 2021-07-30 14:20:54 +02:00
parent f989cea879
commit e4b29a37d6
5 changed files with 21 additions and 25 deletions

View file

@ -1,18 +1,19 @@
from flask import flash, request, url_for 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.contrib.sqla.filters import BaseSQLAFilter
from flask_admin.helpers import get_form_data
from flask_admin.menu import MenuLink from flask_admin.menu import MenuLink
from flask_admin.model.template import EndpointLinkRowAction 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 sqlalchemy import func, or_
from wtforms import Form, BooleanField, SelectField, TextField, RadioField from wtforms import BooleanField, Form, RadioField, SelectField, TextField
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.fields.html5 import DateField from wtforms.fields.html5 import DateField
from wtforms.validators import URL, DataRequired, Email, Optional
from advlabdb import adminSpace, app, db, user_datastore from advlabdb import adminSpace, app, db, user_datastore
from advlabdb.configUtils import getConfig from advlabdb.configUtils import getConfig
from advlabdb.customClasses import SecureAdminModelView from advlabdb.customClasses import SecureAdminModelView
from advlabdb.exceptions import DataBaseException, ModelViewException
from advlabdb.models import ( from advlabdb.models import (
Appointment, Appointment,
Assistant, Assistant,
@ -21,20 +22,15 @@ from advlabdb.models import (
Group, Group,
GroupExperiment, GroupExperiment,
Part, Part,
SemesterExperiment,
PartStudent, PartStudent,
Program,
Role, Role,
Semester, Semester,
SemesterExperiment,
Student, Student,
User, User,
Program,
) )
from advlabdb.utils import ( from advlabdb.utils import randomPassword, setUserActiveSemester, userActiveSemester
randomPassword,
setUserActiveSemester,
userActiveSemester,
)
from advlabdb.exceptions import ModelViewException, DataBaseException
class UserView(SecureAdminModelView): class UserView(SecureAdminModelView):

View file

@ -2,6 +2,7 @@ from flask_security import current_user
from advlabdb import assistantSpace, db from advlabdb import assistantSpace, db
from advlabdb.customClasses import SecureAssistantModelView from advlabdb.customClasses import SecureAssistantModelView
from advlabdb.exceptions import DataBaseException, ModelViewException
from advlabdb.models import ( from advlabdb.models import (
Appointment, Appointment,
Assistant, Assistant,
@ -10,16 +11,15 @@ from advlabdb.models import (
Group, Group,
GroupExperiment, GroupExperiment,
Part, Part,
SemesterExperiment,
PartStudent, PartStudent,
Program,
Role, Role,
Semester, Semester,
SemesterExperiment,
Student, Student,
User, User,
Program,
) )
from advlabdb.utils import userActiveSemester from advlabdb.utils import userActiveSemester
from advlabdb.exceptions import ModelViewException, DataBaseException
class AssistantGroupExperimentView(SecureAssistantModelView): class AssistantGroupExperimentView(SecureAssistantModelView):

View file

@ -1,9 +1,9 @@
from flask import flash, redirect, request, url_for
from flask_admin import AdminIndexView from flask_admin import AdminIndexView
from flask_admin.contrib.sqla import ModelView from flask_admin.contrib.sqla import ModelView
from flask_security import current_user 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(): def adminViewIsAccessible():

View file

@ -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 flask_security import auth_required, current_user
from advlabdb import app from advlabdb import app

12
poetry.lock generated
View file

@ -225,7 +225,7 @@ python-versions = ">=3.5"
[[package]] [[package]]
name = "isort" name = "isort"
version = "5.9.2" version = "5.9.3"
description = "A Python utility / library to sort Python imports." description = "A Python utility / library to sort Python imports."
category = "dev" category = "dev"
optional = false optional = false
@ -373,7 +373,7 @@ sqlcipher = ["sqlcipher3-binary"]
[[package]] [[package]]
name = "tomli" name = "tomli"
version = "1.1.0" version = "1.2.0"
description = "A lil' TOML parser" description = "A lil' TOML parser"
category = "dev" category = "dev"
optional = false optional = false
@ -525,8 +525,8 @@ idna = [
{file = "idna-3.2.tar.gz", hash = "sha256:467fbad99067910785144ce333826c71fb0e63a425657295239737f7ecd125f3"}, {file = "idna-3.2.tar.gz", hash = "sha256:467fbad99067910785144ce333826c71fb0e63a425657295239737f7ecd125f3"},
] ]
isort = [ isort = [
{file = "isort-5.9.2-py3-none-any.whl", hash = "sha256:eed17b53c3e7912425579853d078a0832820f023191561fcee9d7cae424e0813"}, {file = "isort-5.9.3-py3-none-any.whl", hash = "sha256:e17d6e2b81095c9db0a03a8025a957f334d6ea30b26f9ec70805411e5c7c81f2"},
{file = "isort-5.9.2.tar.gz", hash = "sha256:f65ce5bd4cbc6abdfbe29afc2f0245538ab358c14590912df638033f157d555e"}, {file = "isort-5.9.3.tar.gz", hash = "sha256:9c2ea1e62d871267b78307fe511c0838ba0da28698c5732d54e2790bf3ba9899"},
] ]
itsdangerous = [ itsdangerous = [
{file = "itsdangerous-2.0.1-py3-none-any.whl", hash = "sha256:5174094b9637652bdb841a3029700391451bd092ba3db90600dea710ba28e97c"}, {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"}, {file = "SQLAlchemy-1.4.22.tar.gz", hash = "sha256:ec1be26cdccd60d180359a527d5980d959a26269a2c7b1b327a1eea0cab37ed8"},
] ]
tomli = [ tomli = [
{file = "tomli-1.1.0-py3-none-any.whl", hash = "sha256:f4a182048010e89cbec0ae4686b21f550a7f2903f665e34a6de58ec15424f919"}, {file = "tomli-1.2.0-py3-none-any.whl", hash = "sha256:056f0376bf5a6b182c513f9582c1e5b0487265eb6c48842b69aa9ca1cd5f640a"},
{file = "tomli-1.1.0.tar.gz", hash = "sha256:33d7984738f8bb699c9b0a816eb646a8178a69eaa792d258486776a5d21b8ca5"}, {file = "tomli-1.2.0.tar.gz", hash = "sha256:d60e681734099207a6add7a10326bc2ddd1fdc36c1b0f547d00ef73ac63739c2"},
] ]
werkzeug = [ werkzeug = [
{file = "Werkzeug-2.0.1-py3-none-any.whl", hash = "sha256:6c1ec500dcdba0baa27600f6a22f6333d8b662d22027ff9f6202e3367413caa8"}, {file = "Werkzeug-2.0.1-py3-none-any.whl", hash = "sha256:6c1ec500dcdba0baa27600f6a22f6333d8b662d22027ff9f6202e3367413caa8"},