mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +00:00
Added PartExperimentModelView
This commit is contained in:
parent
78fe69cfe1
commit
954fe5ff00
1 changed files with 19 additions and 1 deletions
|
@ -305,6 +305,24 @@ class GroupModelView(SecureModelView):
|
|||
class ExperimentModelView(SecureModelView):
|
||||
can_view_details = True
|
||||
column_filters = ["deprecated"]
|
||||
column_list = ["number", "name", "deprecated"]
|
||||
|
||||
|
||||
class PartExperimentModelView(SecureModelView):
|
||||
column_list = ["experiment", "part", "assistants"]
|
||||
|
||||
partLabels = getConfig("partLabels")
|
||||
column_filters = [PartFilter(PartExperiment.part_id, "Part", options=list(zip(partLabels, partLabels)))]
|
||||
|
||||
def get_query(self):
|
||||
return super().get_query().filter(PartExperiment.part_id.in_([part.id for part in userActiveSemester().parts]))
|
||||
|
||||
def get_count_query(self):
|
||||
return (
|
||||
self.session.query(func.count("*"))
|
||||
.select_from(self.model)
|
||||
.filter(PartExperiment.part_id.in_([part.id for part in userActiveSemester().parts]))
|
||||
)
|
||||
|
||||
|
||||
admin.add_view(StudentModelView(Student, db.session))
|
||||
|
@ -312,7 +330,7 @@ admin.add_view(PartStudentModelView(PartStudent, db.session))
|
|||
admin.add_view(GroupModelView(Group, db.session))
|
||||
admin.add_view(SecureModelView(GroupExperiment, db.session))
|
||||
admin.add_view(ExperimentModelView(Experiment, db.session))
|
||||
admin.add_view(SecureModelView(PartExperiment, db.session))
|
||||
admin.add_view(PartExperimentModelView(PartExperiment, db.session))
|
||||
admin.add_view(SecureModelView(Assistant, db.session))
|
||||
admin.add_view(SecureModelView(Appointment, db.session))
|
||||
admin.add_view(PartModelView(Part, db.session))
|
||||
|
|
Loading…
Reference in a new issue