Fix error 500 when nb_player_{min,max} is unset
This commit is contained in:
parent
a086ee600f
commit
d5d239c3df
1 changed files with 5 additions and 1 deletions
|
@ -88,7 +88,11 @@ class Game(models.Model):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if self.nb_player_min > self.nb_player_max:
|
if (
|
||||||
|
self.nb_player_min is not None
|
||||||
|
and self.nb_player_max is not None
|
||||||
|
and self.nb_player_min > self.nb_player_max
|
||||||
|
):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
{
|
{
|
||||||
"nb_player_max": "Le nombre de joueur·se·s maximum doit être supérieur au nombre de joueur·se·s minimum"
|
"nb_player_max": "Le nombre de joueur·se·s maximum doit être supérieur au nombre de joueur·se·s minimum"
|
||||||
|
|
Loading…
Reference in a new issue