You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.5 KiB
39 lines
1.5 KiB
from app import create_app, db |
|
from app.models import Game, User, Objective, Location, Notification, GamePlayer, \ |
|
PlayerFoundObjective, NotificationPlayer, PlayerCaughtPlayer, Role, GameState |
|
|
|
app = create_app() |
|
|
|
@app.shell_context_processor |
|
def make_shell_context(): |
|
return {'db': db, 'Game' : Game, 'User' : User, 'Objective' : Objective, |
|
'Location' : Location, 'Notification' : Notification, 'GamePlayer' : GamePlayer, |
|
'PlayerFoundObjective' : PlayerFoundObjective, 'NotificationPlayer' : NotificationPlayer, |
|
'PlayerCaughtPlayer' : PlayerCaughtPlayer, 'Role' : Role, 'GameState' : GameState, |
|
'create_objects' : create_objects} |
|
|
|
def create_objects(): |
|
g1 = Game(name='TestGame') |
|
g2 = Game(name='MyGame') |
|
|
|
u1 = User(name='Marijn') |
|
u1.set_password('123') |
|
u2 = User(name='Rogier') |
|
u2.set_password('123') |
|
u3 = User(name='Henk') |
|
u4 = User(name='Emma') |
|
u5 = User(name='Demi') |
|
|
|
g1.game_players.append(GamePlayer(user=u1, role=Role.owner)) |
|
g1.game_players.append(GamePlayer(user=u2, role=Role.hunter)) |
|
g1.game_players.append(GamePlayer(user=u3, role=Role.hunter)) |
|
g1.game_players.append(GamePlayer(user=u4, role=Role.bunny)) |
|
g1.game_players.append(GamePlayer(user=u5, role=Role.bunny)) |
|
|
|
g2.game_players.append(GamePlayer(user=u1, role=Role.bunny)) |
|
g2.game_players.append(GamePlayer(user=u2, role=Role.owner)) |
|
g2.game_players.append(GamePlayer(user=u3, role=Role.hunter)) |
|
|
|
db.session.add(g1) |
|
db.session.add(g2) |
|
db.session.commit() |