From daac77ba578d5289fb0966ca8481a5588b78d66d Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 17 Jan 2021 16:23:48 +0100 Subject: [PATCH] Linting --- apps/participation/forms.py | 2 +- .../management/commands/fix_sympa_lists.py | 2 +- apps/participation/urls.py | 11 +++++------ apps/participation/views.py | 10 +++++----- apps/registration/tests.py | 2 +- apps/registration/views.py | 5 ++--- tfjm/views.py | 1 - 7 files changed, 15 insertions(+), 18 deletions(-) diff --git a/apps/participation/forms.py b/apps/participation/forms.py index c6ef3bf..6611fcb 100644 --- a/apps/participation/forms.py +++ b/apps/participation/forms.py @@ -9,7 +9,7 @@ from django.core.exceptions import ValidationError from django.utils import formats from django.utils.translation import gettext_lazy as _ -from .models import Note, Participation, Passage, Pool, Team, Tournament, Solution, Synthesis +from .models import Note, Participation, Passage, Pool, Solution, Synthesis, Team, Tournament class TeamForm(forms.ModelForm): diff --git a/apps/participation/management/commands/fix_sympa_lists.py b/apps/participation/management/commands/fix_sympa_lists.py index ef70e53..404309a 100644 --- a/apps/participation/management/commands/fix_sympa_lists.py +++ b/apps/participation/management/commands/fix_sympa_lists.py @@ -71,4 +71,4 @@ class Command(BaseCommand): sympa.subscribe(volunteer.user.email, f"jurys-{slug}", True) for admin in AdminRegistration.objects.all(): - sympa.subscribe(admin.user.email, f"admins", True) + sympa.subscribe(admin.user.email, "admins", True) diff --git a/apps/participation/urls.py b/apps/participation/urls.py index 09151ef..8a4c289 100644 --- a/apps/participation/urls.py +++ b/apps/participation/urls.py @@ -4,12 +4,11 @@ from django.urls import path from django.views.generic import TemplateView -from .views import CreateTeamView, JoinTeamView, \ - MyParticipationDetailView, MyTeamDetailView, NoteUpdateView, ParticipationDetailView, \ - PassageCreateView, PassageDetailView, PassageUpdateView, PoolCreateView, PoolDetailView, \ - PoolUpdateView, PoolUpdateTeamsView, TeamAuthorizationsView, TeamDetailView, TeamLeaveView, TeamListView, \ - TeamUpdateView, TournamentCreateView, TournamentDetailView, TournamentListView, TournamentUpdateView, \ - SolutionUploadView, SynthesisUploadView +from .views import CreateTeamView, JoinTeamView, MyParticipationDetailView, MyTeamDetailView, NoteUpdateView, \ + ParticipationDetailView, PassageCreateView, PassageDetailView, PassageUpdateView, PoolCreateView, PoolDetailView, \ + PoolUpdateTeamsView, PoolUpdateView, SolutionUploadView, SynthesisUploadView, TeamAuthorizationsView, \ + TeamDetailView, TeamLeaveView, TeamListView, TeamUpdateView, TournamentCreateView, TournamentDetailView, \ + TournamentListView, TournamentUpdateView app_name = "participation" diff --git a/apps/participation/views.py b/apps/participation/views.py index 8519a89..63386b9 100644 --- a/apps/participation/views.py +++ b/apps/participation/views.py @@ -9,7 +9,7 @@ from django.contrib.sites.models import Site from django.core.exceptions import PermissionDenied from django.core.mail import send_mail from django.db import transaction -from django.http import HttpResponse, Http404 +from django.http import Http404, HttpResponse from django.shortcuts import redirect from django.template.loader import render_to_string from django.urls import reverse_lazy @@ -24,9 +24,9 @@ from tfjm.matrix import Matrix from tfjm.views import AdminMixin, VolunteerMixin from .forms import JoinTeamForm, NoteForm, ParticipationForm, PassageForm, PoolForm, PoolTeamsForm, \ - RequestValidationForm, TeamForm, TournamentForm, ValidateParticipationForm, SolutionForm, SynthesisForm -from .models import Note, Participation, Passage, Pool, Team, Tournament, Solution, Synthesis -from .tables import NoteTable, PassageTable, PoolTable, TeamTable, TournamentTable, ParticipationTable + RequestValidationForm, SolutionForm, SynthesisForm, TeamForm, TournamentForm, ValidateParticipationForm +from .models import Note, Participation, Passage, Pool, Solution, Synthesis, Team, Tournament +from .tables import NoteTable, ParticipationTable, PassageTable, PoolTable, TeamTable, TournamentTable class CreateTeamView(LoginRequiredMixin, CreateView): @@ -434,7 +434,7 @@ class TournamentUpdateView(VolunteerMixin, UpdateView): def dispatch(self, request, *args, **kwargs): if not request.user.is_authenticated or not self.request.user.registration.is_admin \ and not (self.request.user.registration.is_volunteer - and self.request.user.registration.organized_tournaments.all()): + and self.request.user.registration.organized_tournaments.all()): return self.handle_no_permission() return super().dispatch(request, *args, **kwargs) diff --git a/apps/registration/tests.py b/apps/registration/tests.py index 7fd391f..ffa7955 100644 --- a/apps/registration/tests.py +++ b/apps/registration/tests.py @@ -255,7 +255,7 @@ class TestRegistration(TestCase): address="1 Rue de Rivoli, 75001 Paris, France", responsible_name="Toto", responsible_email="toto@example.com")), (self.coach, dict(professional_activity="God", birth_date="2001-01-01", - address="1 Rue de Rivoli, 75001 Paris, France"))]: + address="1 Rue de Rivoli, 75001 Paris, France"))]: response = self.client.get(reverse("registration:update_user", args=(user.pk,))) self.assertEqual(response.status_code, 200) diff --git a/apps/registration/views.py b/apps/registration/views.py index 1d11a1d..d8dde49 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -17,15 +17,14 @@ from django.utils.translation import gettext_lazy as _ from django.views.generic import CreateView, DetailView, RedirectView, TemplateView, UpdateView, View from django_tables2 import SingleTableView from magic import Magic - -from participation.models import Solution, Synthesis, Passage +from participation.models import Passage, Solution, Synthesis from tfjm.tokens import email_validation_token from tfjm.views import AdminMixin, UserMixin, VolunteerMixin from .forms import AddOrganizerForm, AdminRegistrationForm, CoachRegistrationForm, HealthSheetForm, \ ParentalAuthorizationForm, PhotoAuthorizationForm, SignupForm, StudentRegistrationForm, UserForm, \ VolunteerRegistrationForm -from .models import Registration, StudentRegistration, ParticipantRegistration +from .models import ParticipantRegistration, Registration, StudentRegistration from .tables import RegistrationTable diff --git a/tfjm/views.py b/tfjm/views.py index b4a6b24..5160bd9 100644 --- a/tfjm/views.py +++ b/tfjm/views.py @@ -2,7 +2,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later from django.contrib.auth.mixins import LoginRequiredMixin -from django.core.exceptions import PermissionDenied from haystack.generic_views import SearchView