From ff1a0c3bed582f4f9ad3cff64dbbaffb4bc5458b Mon Sep 17 00:00:00 2001 From: Arthur Branchu-Harel Date: Thu, 16 Nov 2023 22:19:15 +0100 Subject: [PATCH] some formating --- insalan/tournament/models.py | 4 ++-- insalan/tournament/serializers.py | 6 +++--- insalan/tournament/views.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/insalan/tournament/models.py b/insalan/tournament/models.py index de2b33c1..42c8e5cc 100644 --- a/insalan/tournament/models.py +++ b/insalan/tournament/models.py @@ -332,7 +332,7 @@ def get_teams_id(self) -> List[int]: def get_rules(self) -> str: """Return the raw tournament rules""" return self.rules - + def get_maxTeam(self) -> int: """Return the max number of teams""" return self.maxTeam @@ -423,7 +423,7 @@ def get_managers_id(self) -> List[int]: Retrieve the user identifiers of all managers """ return self.get_managers().values_list("id", flat=True) - + def get_password(self) -> str: """Return team password""" return self.password diff --git a/insalan/tournament/serializers.py b/insalan/tournament/serializers.py index 158fb5d9..fe557792 100644 --- a/insalan/tournament/serializers.py +++ b/insalan/tournament/serializers.py @@ -95,12 +95,12 @@ def validate(self, data): raise serializers.ValidationError( _("Utilisateur⋅rice déjà inscrit⋅e dans un tournoi de cet évènement") ) - + if len(data.get("players_pseudos", [])) != len(data.get("get_players_id", [])): raise serializers.ValidationError(_("Il manque des pseudos de joueur⋅euses")) return data - + def create(self, validated_data): """Create a Team from input data""" @@ -192,7 +192,7 @@ class Meta: model = Manager fields = "__all__" - + def validate(self, data): event = Event.objects.get(tournament__team=data["team"]) if not unique_event_registration(data["user"],event): diff --git a/insalan/tournament/views.py b/insalan/tournament/views.py index aacb2822..44445ec7 100644 --- a/insalan/tournament/views.py +++ b/insalan/tournament/views.py @@ -273,7 +273,7 @@ def post(self, request, *args, **kwargs): ] } ) - + if not check_password(data["password"], Team.objects.get(pk=data["team"]).get_password()): return Response( { "password": _("Mot de passe invalide.")}, @@ -337,7 +337,7 @@ def post(self, request, *args, **kwargs): raise PermissionDenied() if ( - "team" not in data + "team" not in data or "payment" in data or "password" not in data ) :