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

Use column_display_all_relations

This commit is contained in:
Mo 2022-05-30 02:53:17 +02:00
parent 813d6102a2
commit 1e27182bd6

View file

@ -300,17 +300,13 @@ class SemesterView(SecureAdminModelView):
can_edit = False can_edit = False
can_delete = False can_delete = False
can_view_details = True can_view_details = True
column_display_all_relations = True
column_list = [ column_list = [
"label", "label",
"year", "year",
"parts", "parts",
] ]
column_details_list = column_list + [
"semester_experiments",
"active_users",
"groups",
]
column_searchable_list = [ column_searchable_list = [
"label", "label",
"year", "year",
@ -355,19 +351,17 @@ def programQueryFactory():
class PartView(SecureAdminModelView): class PartView(SecureAdminModelView):
can_view_details = True can_view_details = True
column_display_all_relations = True
column_sortable_list = [] column_sortable_list = []
column_list = [ column_list = [
"program", "program",
"number", "number",
] ]
column_details_list = column_list + [ column_details_exclude_list = [
"part_students", "semester",
]
form_columns = [
"program",
"number",
] ]
form_columns = column_list
form_extra_fields = { form_extra_fields = {
"program": QuerySelectField( "program": QuerySelectField(
@ -393,6 +387,7 @@ class PartView(SecureAdminModelView):
class StudentView(SecureAdminModelView): class StudentView(SecureAdminModelView):
can_view_details = True can_view_details = True
column_display_all_relations = True
column_list = [ column_list = [
"student_number", "student_number",
@ -405,11 +400,6 @@ class StudentView(SecureAdminModelView):
column_descriptions = { column_descriptions = {
"contact_email": "The preferred contact email address if entered by the student", "contact_email": "The preferred contact email address if entered by the student",
} }
column_details_list = column_list + [
"bachelor_thesis",
"bachelor_thesis_work_group",
"note",
]
column_sortable_list = [ column_sortable_list = [
"student_number", "student_number",
@ -504,13 +494,7 @@ class PartStudentView(SecureAdminModelView):
student = None student = None
part = None part = None
column_list = [ column_display_all_relations = True
"student",
"part",
"group",
"final_part_mark",
"experiment_marks",
]
column_filters = ( column_filters = (
PartFilter(PartStudent, "Part"), PartFilter(PartStudent, "Part"),
@ -591,15 +575,11 @@ class GroupView(SecureAdminModelView):
return CustomForm return CustomForm
can_view_details = True column_display_all_relations = True
column_list = [ column_exclude_list = [
"number", "semester",
"program",
"part_students",
"group_experiments",
] ]
column_details_list = column_list
column_filters = ( column_filters = (
ProgramFilter(Group, "Program"), ProgramFilter(Group, "Program"),
@ -628,6 +608,7 @@ class ExperimentView(SecureAdminModelView):
return query.where(Experiment.program_id == int(value)) return query.where(Experiment.program_id == int(value))
can_view_details = True can_view_details = True
column_display_all_relations = True
column_filters = ( column_filters = (
ProgramFilter(Experiment, "Program"), ProgramFilter(Experiment, "Program"),
@ -644,22 +625,19 @@ class ExperimentView(SecureAdminModelView):
column_descriptions = { column_descriptions = {
"active": "Active experiments are present in new semesters", "active": "Active experiments are present in new semesters",
} }
column_details_list = column_list + [ column_searchable_list = [
"number",
"title",
]
form_columns = column_list + [
"description", "description",
"wiki_link", "wiki_link",
"building", "building",
"room", "room",
"responsibility", "responsibility",
"duration_in_days", "duration_in_days",
"semester_experiments",
] ]
column_searchable_list = [
"number",
"title",
]
form_columns = column_details_list.copy()
form_columns.remove("semester_experiments")
column_editable_list = [ column_editable_list = [
"active", "active",
@ -740,16 +718,14 @@ class SemesterExperimentView(SecureAdminModelView):
experiment = None experiment = None
can_view_details = True can_view_details = True
column_display_all_relations = True
column_list = [ column_list = [
"experiment", "experiment",
"assistants", "assistants",
] ]
column_details_list = column_list + [ column_details_exclude_list = [
"oral_weighting", "semester",
"protocol_weighting",
"final_weighting",
"group_experiments",
] ]
column_filters = (ProgramFilter(SemesterExperiment, "Program"),) column_filters = (ProgramFilter(SemesterExperiment, "Program"),)
@ -996,15 +972,7 @@ class GroupExperimentView(SecureAdminModelView):
) )
can_edit = False can_edit = False
can_view_details = True column_display_all_relations = True
column_list = [
"group",
"semester_experiment",
"appointments",
"experiment_marks",
]
column_details_list = column_list
column_filters = ( column_filters = (
ExperimentFilter(GroupExperiment, "Experiment"), ExperimentFilter(GroupExperiment, "Experiment"),
@ -1305,6 +1273,7 @@ class ExperimentMarkView(SecureAdminModelView):
), ),
] ]
# TODO: Find solution
""" """
# Deactivated for the experiments history of a student. # Deactivated for the experiments history of a student.
def query_modifier(self, query): def query_modifier(self, query):
@ -1337,18 +1306,18 @@ class ExperimentMarkView(SecureAdminModelView):
class ProgramView(SecureAdminModelView): class ProgramView(SecureAdminModelView):
can_export = False can_export = False
can_set_page_size = False can_set_page_size = False
can_view_details = True can_view_details = True
column_display_all_relations = True
column_list = [ column_list = [
"label", "label",
] ]
column_sortable_list = []
form_excluded_columns = [ form_excluded_columns = [
"parts", "parts",
"experiments", "experiments",
"groups", "groups",
] ]
column_details_list = column_list + form_excluded_columns
class ImportView(SecureAdminBaseView): class ImportView(SecureAdminBaseView):