1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-09-19 18:31:16 +00:00

Done PartView and SemesterView

This commit is contained in:
Mo 2021-07-29 16:27:15 +02:00
parent 97497b3ad1
commit 6ee368d0ef

View file

@ -96,28 +96,29 @@ class RoleView(SecureModelView):
class SemesterView(SecureModelView):
class CreateForm(Form):
label = RadioField("Semester", choices=["WS", "SS"], validators=[DataRequired()])
year = TextField("Year", validators=[DataRequired()])
transfer_parts = BooleanField(
"Transfer parts",
description="This option transfers the parts you have in your current active semester. Make sure that your semester is the last semester before creating a new one (recommended)!",
default=True,
)
transfer_assistants = BooleanField(
"Transfer Assistants",
description="This option transfers assistants of your active semester to active experiments in the new semester. Make sure that your semester is the last semester before creating a new one (recommended)! Active experiments are transfered anyway. If you do not want an experiment to be transfered, set it to inactive before creating the new semester. Experiments which are switched to active before creating the new semester will be created in the new semester without assistants. It is important to check the assistants of all experiments after creating a new semester.",
default=True,
)
form = CreateForm
can_edit = False
can_delete = False
can_view_details = True
column_list = ["label", "number", "parts"]
column_details_list = column_list + ["active_users", "groups"]
form_columns = ["label", "year", "transfer_parts", "transfer_assistants"]
form_extra_fields = {
"label": RadioField("Semester", choices=["WS", "SS"], validators=[DataRequired()]),
"year": TextField("Year", validators=[DataRequired()]),
"transfer_parts": BooleanField(
"Transfer parts",
description="This option transfers the parts you have in your current active semester. Make sure that your semester is the last semester before creating a new one (recommended)!",
default=True,
),
"transfer_assistants": BooleanField(
"Transfer Assistants",
description="This option transfers assistants of your active semester to active experiments in the new semester. Make sure that your semester is the last semester before creating a new one (recommended)! Active experiments are transfered anyway. If you do not want an experiment to be transfered, set it to inactive before creating the new semester. Experiments which are switched to active before creating the new semester will be created in the new semester without assistants. It is important to check the assistants of all experiments after creating a new semester.",
default=True,
),
}
column_list = ["label", "year", "parts"]
column_details_list = column_list + ["semester_experiments", "active_users", "groups"]
column_searchable_list = ["label", "year"]
def create_model(self, form):
try:
@ -155,7 +156,9 @@ class SemesterView(SecureModelView):
class PartView(SecureModelView):
can_view_details = True
column_details_list = ["program", "number", "semester", "part_students"]
column_sortable_list = []
column_list = ["program", "number", "semester"]
column_details_list = column_list + ["part_students"]
form_columns = ["program", "number", "semester"]
def queryFilter(self):