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.
37 lines
1.5 KiB
37 lines
1.5 KiB
from app import create_app, db |
|
from app.models import Game, Player, 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, 'Player' : Player, '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') |
|
|
|
p1 = Player(name='Marijn') |
|
p2 = Player(name='Rogier') |
|
p3 = Player(name='Henk') |
|
p4 = Player(name='Emma') |
|
p5 = Player(name='Demi') |
|
|
|
g1.game_players.append(GamePlayer(player=p1, role=Role.owner)) |
|
g1.game_players.append(GamePlayer(player=p2, role=Role.hunter)) |
|
g1.game_players.append(GamePlayer(player=p3, role=Role.hunter)) |
|
g1.game_players.append(GamePlayer(player=p4, role=Role.bunny)) |
|
g1.game_players.append(GamePlayer(player=p5, role=Role.bunny)) |
|
|
|
g2.game_players.append(GamePlayer(player=p1, role=Role.bunny)) |
|
g2.game_players.append(GamePlayer(player=p2, role=Role.owner)) |
|
g2.game_players.append(GamePlayer(player=p3, role=Role.hunter)) |
|
|
|
db.session.add(g1) |
|
db.session.add(g2) |
|
db.session.commit() |