mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-20 23:41:20 +00:00
Renamed ModelViews
This commit is contained in:
parent
d9eaafeb6d
commit
8444f9babc
1 changed files with 22 additions and 22 deletions
|
@ -34,7 +34,7 @@ from advlabdb.utils import (
|
|||
)
|
||||
|
||||
|
||||
class UserModelView(SecureModelView):
|
||||
class UserView(SecureModelView):
|
||||
column_list = ["email", "active", "roles", "assistant"]
|
||||
column_searchable_list = ["email"]
|
||||
column_filters = ["active"]
|
||||
|
@ -91,7 +91,7 @@ class UserModelView(SecureModelView):
|
|||
return super().handle_view_exception(exc)
|
||||
|
||||
|
||||
class RoleModelView(SecureModelView):
|
||||
class RoleView(SecureModelView):
|
||||
can_create = False
|
||||
can_edit = False
|
||||
can_delete = False
|
||||
|
@ -100,7 +100,7 @@ class RoleModelView(SecureModelView):
|
|||
column_list = ["name", "description"]
|
||||
|
||||
|
||||
class SemesterModelView(SecureModelView):
|
||||
class SemesterView(SecureModelView):
|
||||
can_edit = False
|
||||
|
||||
column_list = ["label", "parts"]
|
||||
|
@ -168,7 +168,7 @@ class SemesterModelView(SecureModelView):
|
|||
self.session.rollback()
|
||||
|
||||
|
||||
class PartModelView(SecureModelView):
|
||||
class PartView(SecureModelView):
|
||||
can_view_details = True
|
||||
column_details_list = ["label", "semester", "part_experiments", "part_students", "groups"]
|
||||
form_columns = ["label", "semester"]
|
||||
|
@ -187,7 +187,7 @@ class PartModelView(SecureModelView):
|
|||
)
|
||||
|
||||
|
||||
class StudentModelView(SecureModelView):
|
||||
class StudentView(SecureModelView):
|
||||
can_view_details = True
|
||||
|
||||
column_list = ["student_number", "first_name", "last_name", "uni_email", "contact_email", "part_students"]
|
||||
|
@ -208,7 +208,7 @@ def partQueryFactory():
|
|||
return Part.query.filter(Part.id.in_([part.id for part in userActiveSemester().parts]))
|
||||
|
||||
|
||||
class PartStudentModelView(SecureModelView):
|
||||
class PartStudentView(SecureModelView):
|
||||
class CreateForm(Form):
|
||||
def studentQueryFactory():
|
||||
return Student.query
|
||||
|
@ -260,7 +260,7 @@ class PartStudentModelView(SecureModelView):
|
|||
)
|
||||
|
||||
|
||||
class GroupModelView(SecureModelView):
|
||||
class GroupView(SecureModelView):
|
||||
class CreateForm(Form):
|
||||
def partStudentsQueryFactory():
|
||||
return PartStudent.query.filter(PartStudent.part_id.in_([part.id for part in userActiveSemester().parts]))
|
||||
|
@ -329,13 +329,13 @@ class GroupModelView(SecureModelView):
|
|||
)
|
||||
|
||||
|
||||
class ExperimentModelView(SecureModelView):
|
||||
class ExperimentView(SecureModelView):
|
||||
can_view_details = True
|
||||
column_filters = ["deprecated"]
|
||||
column_list = ["number", "name", "deprecated"]
|
||||
|
||||
|
||||
class PartExperimentModelView(SecureModelView):
|
||||
class PartExperimentView(SecureModelView):
|
||||
column_list = ["experiment", "part", "assistants"]
|
||||
|
||||
partLabels = getConfig("partLabels")
|
||||
|
@ -352,7 +352,7 @@ class PartExperimentModelView(SecureModelView):
|
|||
)
|
||||
|
||||
|
||||
class AssistantModelView(SecureModelView):
|
||||
class AssistantView(SecureModelView):
|
||||
can_view_details = True
|
||||
column_list = ["first_name", "last_name", "email", "user", "part_experiments"]
|
||||
column_details_list = column_list + ["phone_number", "mobile_phone_number", "room", "building", "experiment_marks"]
|
||||
|
@ -360,7 +360,7 @@ class AssistantModelView(SecureModelView):
|
|||
form_excluded_columns = ["experiment_marks"]
|
||||
|
||||
|
||||
class GroupExperimentModelView(SecureModelView):
|
||||
class GroupExperimentView(SecureModelView):
|
||||
column_list = ["group", "part_experiment", "appointments", "experiment_marks"]
|
||||
|
||||
def get_query(self):
|
||||
|
@ -392,19 +392,19 @@ class GroupExperimentModelView(SecureModelView):
|
|||
)
|
||||
|
||||
|
||||
admin.add_view(StudentModelView(Student, db.session))
|
||||
admin.add_view(PartStudentModelView(PartStudent, db.session))
|
||||
admin.add_view(GroupModelView(Group, db.session))
|
||||
admin.add_view(GroupExperimentModelView(GroupExperiment, db.session))
|
||||
admin.add_view(ExperimentModelView(Experiment, db.session))
|
||||
admin.add_view(PartExperimentModelView(PartExperiment, db.session))
|
||||
admin.add_view(AssistantModelView(Assistant, db.session))
|
||||
admin.add_view(StudentView(Student, db.session))
|
||||
admin.add_view(PartStudentView(PartStudent, db.session))
|
||||
admin.add_view(GroupView(Group, db.session))
|
||||
admin.add_view(GroupExperimentView(GroupExperiment, db.session))
|
||||
admin.add_view(ExperimentView(Experiment, db.session))
|
||||
admin.add_view(PartExperimentView(PartExperiment, db.session))
|
||||
admin.add_view(AssistantView(Assistant, db.session))
|
||||
admin.add_view(SecureModelView(Appointment, db.session))
|
||||
admin.add_view(PartModelView(Part, db.session))
|
||||
admin.add_view(SemesterModelView(Semester, db.session))
|
||||
admin.add_view(PartView(Part, db.session))
|
||||
admin.add_view(SemesterView(Semester, db.session))
|
||||
admin.add_view(SecureModelView(ExperimentMark, db.session))
|
||||
admin.add_view(UserModelView(User, db.session))
|
||||
admin.add_view(RoleModelView(Role, db.session))
|
||||
admin.add_view(UserView(User, db.session))
|
||||
admin.add_view(RoleView(Role, db.session))
|
||||
|
||||
with app.app_context():
|
||||
semesters = Semester.query.all()[::-1]
|
||||
|
|
Loading…
Reference in a new issue