0a570aa2c6
add search to userlist
42 lines
1,010 B
Python
42 lines
1,010 B
Python
import random
|
|
import string
|
|
|
|
from app import db
|
|
from models import Achievement, User
|
|
|
|
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)
|
|
|
|
# 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)
|
|
|
|
db.session.add(persoonA)
|
|
db.session.add(persoonB)
|
|
db.session.add(persoonC)
|
|
|
|
db.session.add(achievementA)
|
|
db.session.add(achievementB)
|
|
|
|
db.session.commit()
|