1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-12-20 23:41:20 +00:00

Added AssistantUserView

This commit is contained in:
Mo 2021-11-30 01:47:37 +01:00
parent 300d869ed8
commit 22e3e9ff7b

View file

@ -29,14 +29,6 @@ from advlabdb.utils import initActiveSemesterMenuLinks, userActiveSemester
class AssistantAppointmentView(SecureAssistantModelView):
can_export = False
can_set_page_size = False
can_create = False
can_delete = False
can_edit = False
column_display_actions = False
column_list = [
"date",
"special",
@ -50,7 +42,9 @@ class AssistantAppointmentView(SecureAssistantModelView):
"group_experiment.group.part_students": "Students",
}
column_editable_list = ["date"]
column_editable_list = [
"date",
]
def queryFilter(self):
return and_(
@ -62,14 +56,6 @@ class AssistantAppointmentView(SecureAssistantModelView):
class AssistantExperimentMarkView(SecureAssistantModelView):
can_export = False
can_set_page_size = False
can_create = False
can_delete = False
can_edit = False
column_display_actions = False
column_list = [
"oral_mark",
"protocol_mark",
@ -102,7 +88,10 @@ class AssistantExperimentMarkView(SecureAssistantModelView):
"edited_by_admin": "If the mark was edited by an admin",
}
column_editable_list = ["oral_mark", "protocol_mark"]
column_editable_list = [
"oral_mark",
"protocol_mark",
]
form_args = {
"oral_mark": {"validators": [NumberRange(0, 15)]},
"protocol_mark": {"validators": [NumberRange(0, 15)]},
@ -136,11 +125,38 @@ class AssistantExperimentMarkView(SecureAssistantModelView):
return True
class AssistantUserView(SecureAssistantModelView):
column_sortable_list = []
column_list = [
"email",
"phone_number",
"mobile_phone_number",
"room",
"building",
"assistant.semester_experiments",
]
column_labels = {
"assistant.semester_experiments": "Semester Experiments",
}
column_editable_list = [
"phone_number",
"mobile_phone_number",
"room",
"building",
]
def queryFilter(self):
return User.id == current_user.id
assistantSpace.add_view(
AssistantAppointmentView(Appointment, db.session, endpoint="assistant_appointment", url="appointment")
)
assistantSpace.add_view(
AssistantExperimentMarkView(ExperimentMark, db.session, endpoint="assistant_experimentmark", url="experimentmark")
)
assistantSpace.add_view(AssistantUserView(User, db.session, endpoint="assistant_user", url="user"))
initActiveSemesterMenuLinks(assistantSpace)