fix: model, limite length of
tournament.name and winner_id can be null now
This commit is contained in:
parent
288252ab37
commit
56cfd563d7
@ -5,7 +5,7 @@ class GameModel(models.Model):
|
|||||||
|
|
||||||
finished = models.BooleanField(default=False)
|
finished = models.BooleanField(default=False)
|
||||||
started = 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]):
|
def create(self, users_id: [int]):
|
||||||
self.save()
|
self.save()
|
||||||
|
@ -5,7 +5,7 @@ from games.models import GameModel
|
|||||||
# Create your models here.tu
|
# Create your models here.tu
|
||||||
class TournamentModel(models.Model):
|
class TournamentModel(models.Model):
|
||||||
|
|
||||||
name = models.CharField()
|
name = models.CharField(max_length=100)
|
||||||
nb_players = models.IntegerField()
|
nb_players = models.IntegerField()
|
||||||
nb_players_by_game = models.IntegerField()
|
nb_players_by_game = models.IntegerField()
|
||||||
level = models.IntegerField()
|
level = models.IntegerField()
|
||||||
@ -21,7 +21,9 @@ class TournamentModel(models.Model):
|
|||||||
self.nb_players = nb_players
|
self.nb_players = nb_players
|
||||||
self.nb_players_by_game = nb_players_by_game
|
self.nb_players_by_game = nb_players_by_game
|
||||||
self.name = name
|
self.name = name
|
||||||
return self.save()
|
self.save()
|
||||||
|
|
||||||
|
return self.pk
|
||||||
|
|
||||||
def create_game(self, users_id):
|
def create_game(self, users_id):
|
||||||
game_id = GameModel.create(users_id=users_id)
|
game_id = GameModel.create(users_id=users_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user