1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-08 21:21:06 +00:00

Added defaults for semester label and year

This commit is contained in:
Mo 2021-07-30 00:40:21 +02:00
parent e85b56444a
commit ba0691015d

View file

@ -139,8 +139,21 @@ class RoleView(SecureModelView):
class SemesterView(SecureModelView): class SemesterView(SecureModelView):
class CreateForm(Form): class CreateForm(Form):
label = RadioField("Semester", choices=["WS", "SS"], validators=[DataRequired()]) def labelDefault():
year = TextField("Year", validators=[DataRequired()]) if userActiveSemester().label == "WS":
return "SS"
else:
return "WS"
def yearDefault():
activeSemester = userActiveSemester()
if activeSemester.label == "WS":
return activeSemester.year + 1
else:
return activeSemester.year
label = RadioField("Semester", choices=["WS", "SS"], validators=[DataRequired()], default=labelDefault)
year = TextField("Year", validators=[DataRequired()], default=yearDefault)
transfer_parts = BooleanField( transfer_parts = BooleanField(
"Transfer parts", "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)!", 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)!",