endorsement/test.py

24 lines
492 B
Python
Raw Normal View History

from models import User, Achievement
from app import db
db.drop_all()
db.create_all()
persoonA = User(id="AAA")
persoonB = User(id="BBB")
persoonC = User(id="CCC")
achievementA = Achievement(name="AA", achieved_by=persoonA.id)
achievementB = Achievement(name="BB", achieved_by=persoonB.id)
achievementA.endorsed_by.append(persoonC)
db.session.add(persoonA)
db.session.add(persoonB)
db.session.add(persoonC)
db.session.add(achievementA)
db.session.add(achievementB)
db.session.commit()