diff --git a/advlabdb/adminModelViews.py b/advlabdb/adminModelViews.py index 5bc4cba..3f3d11a 100644 --- a/advlabdb/adminModelViews.py +++ b/advlabdb/adminModelViews.py @@ -148,8 +148,7 @@ class UserView(SecureAdminModelView): active_semester = QuerySelectField( "Active Semester", query_factory=semesterQueryFactory, - allow_blank=True, - blank_text="-", + validators=[DataRequired()], default=lastSemester, description="Not fixed and users (including assistants) can change it.", ) diff --git a/advlabdb/scripts/setup/init_database.py b/advlabdb/scripts/setup/init_database.py index 5319cc0..adbf1ed 100644 --- a/advlabdb/scripts/setup/init_database.py +++ b/advlabdb/scripts/setup/init_database.py @@ -69,6 +69,7 @@ def main(): mobile_phone_number=admin_mobile_phone_number.strip() or None, building=admin_building.strip() or None, room=admin_room.strip() or None, + active_semester=semester, ) admin = Admin(user=admin_user) diff --git a/advlabdb/scripts/test/test_database.py b/advlabdb/scripts/test/test_database.py index 184e59c..f5eb754 100644 --- a/advlabdb/scripts/test/test_database.py +++ b/advlabdb/scripts/test/test_database.py @@ -107,6 +107,7 @@ def main(): roles=[adminRole], first_name="Peter", last_name="Blümler", + active_semester=sem2, ) admin = Admin(user=admin_user) @@ -121,6 +122,7 @@ def main(): last_name="l", phone_number="012333212", mobile_phone_number="012334123", + active_semester=sem2, ) us2 = user_datastore.create_user( email="test2@protonmail.com", @@ -128,6 +130,7 @@ def main(): roles=[assistantRole], first_name="As2", last_name="l", + active_semester=sem2, ) as1 = Assistant(user=us1)