mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-20 23:41:20 +00:00
Added defaults for semester label and year
This commit is contained in:
parent
e85b56444a
commit
ba0691015d
1 changed files with 15 additions and 2 deletions
|
@ -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)!",
|
||||||
|
|
Loading…
Reference in a new issue