Format with Black

This commit is contained in:
2022-10-24 20:00:39 -05:00
parent 7d684d8b9d
commit 07ecd2248c
4 changed files with 52 additions and 38 deletions

View File

@@ -8,16 +8,18 @@ import datetime
from peewee import *
# User can provide path to database, or it will be put next to main.py
DATABASE = os.environ.get('database_path', os.getcwd() + '/ghostball.db')
DATABASE = os.environ.get("database_path", os.getcwd() + "/ghostball.db")
database = SqliteDatabase(DATABASE)
class BaseModel(Model):
"""All of our models will inherit this class
and use the same database connection"""
and use the same database connection"""
class Meta:
database = database
class GameModel(BaseModel):
game_id = UUIDField(primary_key=True)
@@ -27,10 +29,11 @@ class GameModel(BaseModel):
date_created = DateTimeField(default=datetime.datetime.now)
date_ended = DateTimeField(null=True)
class GuessModel(BaseModel):
player_id = IntegerField(primary_key=True)
game_id = ForeignKeyField(GameModel, backref="guesses")
game_id = ForeignKeyField(GameModel, backref="guesses")
player_name = CharField()
guess = IntegerField()