mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +00:00
Use column_display_all_relations
This commit is contained in:
parent
813d6102a2
commit
1e27182bd6
1 changed files with 24 additions and 55 deletions
|
@ -300,17 +300,13 @@ class SemesterView(SecureAdminModelView):
|
|||
can_edit = False
|
||||
can_delete = False
|
||||
can_view_details = True
|
||||
column_display_all_relations = True
|
||||
|
||||
column_list = [
|
||||
"label",
|
||||
"year",
|
||||
"parts",
|
||||
]
|
||||
column_details_list = column_list + [
|
||||
"semester_experiments",
|
||||
"active_users",
|
||||
"groups",
|
||||
]
|
||||
column_searchable_list = [
|
||||
"label",
|
||||
"year",
|
||||
|
@ -355,19 +351,17 @@ def programQueryFactory():
|
|||
|
||||
class PartView(SecureAdminModelView):
|
||||
can_view_details = True
|
||||
column_display_all_relations = True
|
||||
|
||||
column_sortable_list = []
|
||||
column_list = [
|
||||
"program",
|
||||
"number",
|
||||
]
|
||||
column_details_list = column_list + [
|
||||
"part_students",
|
||||
]
|
||||
form_columns = [
|
||||
"program",
|
||||
"number",
|
||||
column_details_exclude_list = [
|
||||
"semester",
|
||||
]
|
||||
form_columns = column_list
|
||||
|
||||
form_extra_fields = {
|
||||
"program": QuerySelectField(
|
||||
|
@ -393,6 +387,7 @@ class PartView(SecureAdminModelView):
|
|||
|
||||
class StudentView(SecureAdminModelView):
|
||||
can_view_details = True
|
||||
column_display_all_relations = True
|
||||
|
||||
column_list = [
|
||||
"student_number",
|
||||
|
@ -405,11 +400,6 @@ class StudentView(SecureAdminModelView):
|
|||
column_descriptions = {
|
||||
"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 = [
|
||||
"student_number",
|
||||
|
@ -504,13 +494,7 @@ class PartStudentView(SecureAdminModelView):
|
|||
student = None
|
||||
part = None
|
||||
|
||||
column_list = [
|
||||
"student",
|
||||
"part",
|
||||
"group",
|
||||
"final_part_mark",
|
||||
"experiment_marks",
|
||||
]
|
||||
column_display_all_relations = True
|
||||
|
||||
column_filters = (
|
||||
PartFilter(PartStudent, "Part"),
|
||||
|
@ -591,15 +575,11 @@ class GroupView(SecureAdminModelView):
|
|||
|
||||
return CustomForm
|
||||
|
||||
can_view_details = True
|
||||
column_display_all_relations = True
|
||||
|
||||
column_list = [
|
||||
"number",
|
||||
"program",
|
||||
"part_students",
|
||||
"group_experiments",
|
||||
column_exclude_list = [
|
||||
"semester",
|
||||
]
|
||||
column_details_list = column_list
|
||||
|
||||
column_filters = (
|
||||
ProgramFilter(Group, "Program"),
|
||||
|
@ -628,6 +608,7 @@ class ExperimentView(SecureAdminModelView):
|
|||
return query.where(Experiment.program_id == int(value))
|
||||
|
||||
can_view_details = True
|
||||
column_display_all_relations = True
|
||||
|
||||
column_filters = (
|
||||
ProgramFilter(Experiment, "Program"),
|
||||
|
@ -644,22 +625,19 @@ class ExperimentView(SecureAdminModelView):
|
|||
column_descriptions = {
|
||||
"active": "Active experiments are present in new semesters",
|
||||
}
|
||||
column_details_list = column_list + [
|
||||
column_searchable_list = [
|
||||
"number",
|
||||
"title",
|
||||
]
|
||||
|
||||
form_columns = column_list + [
|
||||
"description",
|
||||
"wiki_link",
|
||||
"building",
|
||||
"room",
|
||||
"responsibility",
|
||||
"duration_in_days",
|
||||
"semester_experiments",
|
||||
]
|
||||
column_searchable_list = [
|
||||
"number",
|
||||
"title",
|
||||
]
|
||||
|
||||
form_columns = column_details_list.copy()
|
||||
form_columns.remove("semester_experiments")
|
||||
|
||||
column_editable_list = [
|
||||
"active",
|
||||
|
@ -740,16 +718,14 @@ class SemesterExperimentView(SecureAdminModelView):
|
|||
experiment = None
|
||||
|
||||
can_view_details = True
|
||||
column_display_all_relations = True
|
||||
|
||||
column_list = [
|
||||
"experiment",
|
||||
"assistants",
|
||||
]
|
||||
column_details_list = column_list + [
|
||||
"oral_weighting",
|
||||
"protocol_weighting",
|
||||
"final_weighting",
|
||||
"group_experiments",
|
||||
column_details_exclude_list = [
|
||||
"semester",
|
||||
]
|
||||
|
||||
column_filters = (ProgramFilter(SemesterExperiment, "Program"),)
|
||||
|
@ -996,15 +972,7 @@ class GroupExperimentView(SecureAdminModelView):
|
|||
)
|
||||
|
||||
can_edit = False
|
||||
can_view_details = True
|
||||
|
||||
column_list = [
|
||||
"group",
|
||||
"semester_experiment",
|
||||
"appointments",
|
||||
"experiment_marks",
|
||||
]
|
||||
column_details_list = column_list
|
||||
column_display_all_relations = True
|
||||
|
||||
column_filters = (
|
||||
ExperimentFilter(GroupExperiment, "Experiment"),
|
||||
|
@ -1305,6 +1273,7 @@ class ExperimentMarkView(SecureAdminModelView):
|
|||
),
|
||||
]
|
||||
|
||||
# TODO: Find solution
|
||||
"""
|
||||
# Deactivated for the experiments history of a student.
|
||||
def query_modifier(self, query):
|
||||
|
@ -1337,18 +1306,18 @@ class ExperimentMarkView(SecureAdminModelView):
|
|||
class ProgramView(SecureAdminModelView):
|
||||
can_export = False
|
||||
can_set_page_size = False
|
||||
|
||||
can_view_details = True
|
||||
column_display_all_relations = True
|
||||
|
||||
column_list = [
|
||||
"label",
|
||||
]
|
||||
column_sortable_list = []
|
||||
form_excluded_columns = [
|
||||
"parts",
|
||||
"experiments",
|
||||
"groups",
|
||||
]
|
||||
column_details_list = column_list + form_excluded_columns
|
||||
|
||||
|
||||
class ImportView(SecureAdminBaseView):
|
||||
|
|
Loading…
Reference in a new issue