diff --git a/games/models.py b/games/models.py index 3c95a6b..0493dc5 100644 --- a/games/models.py +++ b/games/models.py @@ -5,7 +5,7 @@ class GameModel(models.Model): finished = models.BooleanField(default=False) started = models.BooleanField(default=False) - winner_id = models.IntegerField() + winner_id = models.IntegerField(null=True, blank=True) def create(self, users_id: [int]): self.save() diff --git a/tournament/models.py b/tournament/models.py index 7b4ce71..5d2ae37 100644 --- a/tournament/models.py +++ b/tournament/models.py @@ -5,7 +5,7 @@ from games.models import GameModel # Create your models here.tu class TournamentModel(models.Model): - name = models.CharField() + name = models.CharField(max_length=100) nb_players = models.IntegerField() nb_players_by_game = models.IntegerField() level = models.IntegerField() @@ -21,7 +21,9 @@ class TournamentModel(models.Model): self.nb_players = nb_players self.nb_players_by_game = nb_players_by_game self.name = name - return self.save() + self.save() + + return self.pk def create_game(self, users_id): game_id = GameModel.create(users_id=users_id)