2019-08-04 22:27:47 +02:00
|
|
|
import random
|
|
|
|
import string
|
|
|
|
|
2018-11-29 15:46:06 +01:00
|
|
|
from app import db
|
2019-08-04 22:27:47 +02:00
|
|
|
from models import Achievement, User
|
2018-11-29 15:46:06 +01:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2019-08-04 22:27:47 +02:00
|
|
|
# Long generated lists
|
|
|
|
for i in range(30):
|
|
|
|
achievement = Achievement(name=''.join(
|
|
|
|
random.choices(string.ascii_uppercase + string.digits, k=6)),
|
|
|
|
achieved_by=persoonA.id)
|
|
|
|
db.session.add(achievement)
|
|
|
|
|
|
|
|
people = [
|
|
|
|
User(id=''.join(random.choices(string.ascii_uppercase +
|
|
|
|
string.digits, k=6))) for i in range(30)
|
|
|
|
]
|
|
|
|
|
|
|
|
for person in people:
|
|
|
|
db.session.add(person)
|
|
|
|
achievementA.endorsed_by.append(person)
|
|
|
|
|
2018-11-29 15:46:06 +01:00
|
|
|
db.session.add(persoonA)
|
|
|
|
db.session.add(persoonB)
|
|
|
|
db.session.add(persoonC)
|
|
|
|
|
|
|
|
db.session.add(achievementA)
|
|
|
|
db.session.add(achievementB)
|
|
|
|
|
|
|
|
db.session.commit()
|