mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-20 23:41:20 +00:00
Added createParts to Semester
This commit is contained in:
parent
bc8859d521
commit
ad134a923e
2 changed files with 5 additions and 7 deletions
|
@ -58,9 +58,7 @@ class SemesterModelView(SecureModelView):
|
||||||
flash("This semester already has parts!", "danger")
|
flash("This semester already has parts!", "danger")
|
||||||
return
|
return
|
||||||
|
|
||||||
for partLabel in getConfig("partsLabels"):
|
model.createParts()
|
||||||
db.session.add(Part(label=partLabel, semester=model))
|
|
||||||
db.session.commit()
|
|
||||||
|
|
||||||
if is_created:
|
if is_created:
|
||||||
admin.add_link(MenuLink(name=model.label,
|
admin.add_link(MenuLink(name=model.label,
|
||||||
|
|
|
@ -13,11 +13,11 @@ with app.app_context():
|
||||||
db.session.add(sem1)
|
db.session.add(sem1)
|
||||||
db.session.add(sem2)
|
db.session.add(sem2)
|
||||||
|
|
||||||
parta1 = Part(label="A/1", semester=sem2)
|
sem1.createParts()
|
||||||
partb2 = Part(label="B/2", semester=sem2)
|
sem2.createParts()
|
||||||
|
|
||||||
db.session.add(parta1)
|
parta1 = sem2.parts[0]
|
||||||
db.session.add(partb2)
|
partb2 = sem2.parts[1]
|
||||||
|
|
||||||
student1 = Student(student_number=123, first_name="Mo", last_name="Bit", uni_email="m@test.com")
|
student1 = Student(student_number=123, first_name="Mo", last_name="Bit", uni_email="m@test.com")
|
||||||
student2 = Student(student_number=1232, first_name="Mo2", last_name="Bit", uni_email="m2@test.com")
|
student2 = Student(student_number=1232, first_name="Mo2", last_name="Bit", uni_email="m2@test.com")
|
||||||
|
|
Loading…
Reference in a new issue