From a45a0ca1092b4426af714358580f8b46f45bce65 Mon Sep 17 00:00:00 2001 From: Badmajor Date: Fri, 25 Oct 2024 12:38:46 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=BE=D1=88=D0=B5=D0=BB=D1=81?= =?UTF-8?q?=D1=8F=20black=20check=20=D0=B2=20github=20=D0=BD=D0=B5=20?= =?UTF-8?q?=D0=BF=D1=80=D0=BE=D0=BF=D1=83=D1=81=D0=BA=D0=B0=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/api/v1/projects/serializers.py | 5 +---- src/backend/api/v1/projects/views.py | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/backend/api/v1/projects/serializers.py b/src/backend/api/v1/projects/serializers.py index 203456c..f1d2090 100644 --- a/src/backend/api/v1/projects/serializers.py +++ b/src/backend/api/v1/projects/serializers.py @@ -382,10 +382,7 @@ def validate_project(self, value): ) .first() ) - if ( - user == project.creator - or user == project.owner - ): + if user == project.creator or user == project.owner: raise serializers.ValidationError( "Вы не можете создать заявку на участие в проекте, в котором " "уже участвуете." diff --git a/src/backend/api/v1/projects/views.py b/src/backend/api/v1/projects/views.py index dd30304..f1eb22f 100644 --- a/src/backend/api/v1/projects/views.py +++ b/src/backend/api/v1/projects/views.py @@ -303,9 +303,9 @@ def get_queryset(self) -> QuerySet["ParticipationRequest"]: status_filter = self.request.query_params.get("status") if status_filter: queryset = queryset.filter(status=status_filter) - return queryset.filter( - Q(user=self.request.user) - ).only(*PROJECT_PARTICIPATION_REQUEST_ONLY_FIELDS.get(self.action, ())) + return queryset.filter(Q(user=self.request.user)).only( + *PROJECT_PARTICIPATION_REQUEST_ONLY_FIELDS.get(self.action, ()) + ) def get_object(self) -> ParticipationRequest: """Метод получения объекта запроса на участие в проекте."""