mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-20 23:41:20 +00:00
Added AssistantUserView
This commit is contained in:
parent
300d869ed8
commit
22e3e9ff7b
1 changed files with 34 additions and 18 deletions
|
@ -29,14 +29,6 @@ from advlabdb.utils import initActiveSemesterMenuLinks, userActiveSemester
|
||||||
|
|
||||||
|
|
||||||
class AssistantAppointmentView(SecureAssistantModelView):
|
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 = [
|
column_list = [
|
||||||
"date",
|
"date",
|
||||||
"special",
|
"special",
|
||||||
|
@ -50,7 +42,9 @@ class AssistantAppointmentView(SecureAssistantModelView):
|
||||||
"group_experiment.group.part_students": "Students",
|
"group_experiment.group.part_students": "Students",
|
||||||
}
|
}
|
||||||
|
|
||||||
column_editable_list = ["date"]
|
column_editable_list = [
|
||||||
|
"date",
|
||||||
|
]
|
||||||
|
|
||||||
def queryFilter(self):
|
def queryFilter(self):
|
||||||
return and_(
|
return and_(
|
||||||
|
@ -62,14 +56,6 @@ class AssistantAppointmentView(SecureAssistantModelView):
|
||||||
|
|
||||||
|
|
||||||
class AssistantExperimentMarkView(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 = [
|
column_list = [
|
||||||
"oral_mark",
|
"oral_mark",
|
||||||
"protocol_mark",
|
"protocol_mark",
|
||||||
|
@ -102,7 +88,10 @@ class AssistantExperimentMarkView(SecureAssistantModelView):
|
||||||
"edited_by_admin": "If the mark was edited by an admin",
|
"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 = {
|
form_args = {
|
||||||
"oral_mark": {"validators": [NumberRange(0, 15)]},
|
"oral_mark": {"validators": [NumberRange(0, 15)]},
|
||||||
"protocol_mark": {"validators": [NumberRange(0, 15)]},
|
"protocol_mark": {"validators": [NumberRange(0, 15)]},
|
||||||
|
@ -136,11 +125,38 @@ class AssistantExperimentMarkView(SecureAssistantModelView):
|
||||||
return True
|
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(
|
assistantSpace.add_view(
|
||||||
AssistantAppointmentView(Appointment, db.session, endpoint="assistant_appointment", url="appointment")
|
AssistantAppointmentView(Appointment, db.session, endpoint="assistant_appointment", url="appointment")
|
||||||
)
|
)
|
||||||
assistantSpace.add_view(
|
assistantSpace.add_view(
|
||||||
AssistantExperimentMarkView(ExperimentMark, db.session, endpoint="assistant_experimentmark", url="experimentmark")
|
AssistantExperimentMarkView(ExperimentMark, db.session, endpoint="assistant_experimentmark", url="experimentmark")
|
||||||
)
|
)
|
||||||
|
assistantSpace.add_view(AssistantUserView(User, db.session, endpoint="assistant_user", url="user"))
|
||||||
|
|
||||||
initActiveSemesterMenuLinks(assistantSpace)
|
initActiveSemesterMenuLinks(assistantSpace)
|
||||||
|
|
Loading…
Reference in a new issue