mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +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")
|
||||
return
|
||||
|
||||
for partLabel in getConfig("partsLabels"):
|
||||
db.session.add(Part(label=partLabel, semester=model))
|
||||
db.session.commit()
|
||||
model.createParts()
|
||||
|
||||
if is_created:
|
||||
admin.add_link(MenuLink(name=model.label,
|
||||
|
|
|
@ -13,11 +13,11 @@ with app.app_context():
|
|||
db.session.add(sem1)
|
||||
db.session.add(sem2)
|
||||
|
||||
parta1 = Part(label="A/1", semester=sem2)
|
||||
partb2 = Part(label="B/2", semester=sem2)
|
||||
sem1.createParts()
|
||||
sem2.createParts()
|
||||
|
||||
db.session.add(parta1)
|
||||
db.session.add(partb2)
|
||||
parta1 = sem2.parts[0]
|
||||
partb2 = sem2.parts[1]
|
||||
|
||||
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")
|
||||
|
|
Loading…
Reference in a new issue