Wrong import order

This commit is contained in:
Yohann D'ANELLO 2020-12-28 19:19:01 +01:00
parent 0079b6d96d
commit 63f139be45
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
14 changed files with 30 additions and 41 deletions

View File

@ -1,10 +1,10 @@
import getpass import getpass
from tfjm.middlewares import get_current_authenticated_user, get_current_ip
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from rest_framework.renderers import JSONRenderer from rest_framework.renderers import JSONRenderer
from rest_framework.serializers import ModelSerializer from rest_framework.serializers import ModelSerializer
from tfjm.middlewares import get_current_authenticated_user, get_current_ip
from .models import Changelog from .models import Changelog

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from django.apps import AppConfig from django.apps import AppConfig
from django.db.models.signals import post_save, pre_delete, pre_save from django.db.models.signals import post_save, pre_save
class ParticipationConfig(AppConfig): class ParticipationConfig(AppConfig):

View File

@ -4,9 +4,9 @@
import os import os
from asgiref.sync import async_to_sync from asgiref.sync import async_to_sync
from tfjm.matrix import Matrix, RoomPreset, RoomVisibility
from django.core.management import BaseCommand from django.core.management import BaseCommand
from registration.models import AdminRegistration, Registration from registration.models import AdminRegistration, Registration
from tfjm.matrix import Matrix, RoomPreset, RoomVisibility
class Command(BaseCommand): class Command(BaseCommand):

View File

@ -1,11 +1,11 @@
# Copyright (C) 2020 by Animath # Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from tfjm.lists import get_sympa_client
from django.core.management import BaseCommand from django.core.management import BaseCommand
from django.db.models import Q from django.db.models import Q
from participation.models import Team from participation.models import Team
from registration.models import CoachRegistration, StudentRegistration from registration.models import CoachRegistration, StudentRegistration
from tfjm.lists import get_sympa_client
class Command(BaseCommand): class Command(BaseCommand):

View File

@ -2,21 +2,17 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
import os import os
import re
from registration.models import VolunteerRegistration
from tfjm.lists import get_sympa_client
from tfjm.matrix import Matrix, RoomPreset, RoomVisibility
from django.core.exceptions import ObjectDoesNotExist
from django.core.validators import RegexValidator from django.core.validators import RegexValidator
from django.db import models from django.db import models
from django.db.models import Index from django.db.models import Index
from django.template.loader import render_to_string
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils import timezone from django.utils import timezone
from django.utils.crypto import get_random_string from django.utils.crypto import get_random_string
from django.utils.text import format_lazy
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from registration.models import VolunteerRegistration
from tfjm.lists import get_sympa_client
from tfjm.matrix import Matrix, RoomPreset, RoomVisibility
class Team(models.Model): class Team(models.Model):
@ -197,6 +193,9 @@ class Tournament(models.Model):
return Synthesis.objects.filter(final_solution=True) return Synthesis.objects.filter(final_solution=True)
return Synthesis.objects.filter(participation__tournament=self) return Synthesis.objects.filter(participation__tournament=self)
def __str__(self):
return repr(self)
class Meta: class Meta:
verbose_name = _("tournament") verbose_name = _("tournament")
verbose_name_plural = _("tournaments") verbose_name_plural = _("tournaments")
@ -271,12 +270,14 @@ class Pool(models.Model):
def solutions(self): def solutions(self):
return Solution.objects.filter(participation__in=self.participations, final_solution=self.tournament.final) return Solution.objects.filter(participation__in=self.participations, final_solution=self.tournament.final)
def __str__(self):
return repr(self)
class Meta: class Meta:
verbose_name = _("pool") verbose_name = _("pool")
verbose_name_plural = _("pools") verbose_name_plural = _("pools")
class Solution(models.Model): class Solution(models.Model):
participation = models.ForeignKey( participation = models.ForeignKey(
Participation, Participation,
@ -302,6 +303,9 @@ class Solution(models.Model):
default="", default="",
) )
def __str__(self):
return repr(self)
class Meta: class Meta:
verbose_name = _("solution") verbose_name = _("solution")
verbose_name_plural = _("solutions") verbose_name_plural = _("solutions")
@ -337,6 +341,9 @@ class Synthesis(models.Model):
default="", default="",
) )
def __str__(self):
return repr(self)
class Meta: class Meta:
verbose_name = _("synthesis") verbose_name = _("synthesis")
verbose_name_plural = _("syntheses") verbose_name_plural = _("syntheses")

View File

@ -1,8 +1,8 @@
# Copyright (C) 2020 by Animath # Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from tfjm.lists import get_sympa_client
from participation.models import Participation, Team from participation.models import Participation, Team
from tfjm.lists import get_sympa_client
def create_team_participation(instance, created, **_): def create_team_participation(instance, created, **_):
@ -33,4 +33,3 @@ def update_mailing_list(instance: Team, **_):
for coach in instance.coachs.all(): for coach in instance.coachs.all():
get_sympa_client().subscribe(coach.user.email, f"equipe-{instance.trigram.lower()}", False, get_sympa_client().subscribe(coach.user.email, f"equipe-{instance.trigram.lower()}", False,
f"{coach.user.first_name} {coach.user.last_name}") f"{coach.user.first_name} {coach.user.last_name}")

View File

@ -54,20 +54,3 @@ class ParticipationTable(tables.Table):
model = Team model = Team
fields = ('name', 'trigram', 'problem',) fields = ('name', 'trigram', 'problem',)
template_name = 'django_tables2/bootstrap4.html' template_name = 'django_tables2/bootstrap4.html'
class VideoTable(tables.Table):
participation_name = tables.LinkColumn(
'participation:participation_detail',
args=[tables.A("participation__pk")],
verbose_name=lambda: _("name").capitalize(),
accessor=tables.A("participation__team__name"),
)
class Meta:
attrs = {
'class': 'table table condensed table-striped',
}
model = Team
fields = ('participation_name', 'link',)
template_name = 'django_tables2/bootstrap4.html'

View File

@ -4,9 +4,6 @@
from io import BytesIO from io import BytesIO
from zipfile import ZipFile from zipfile import ZipFile
from tfjm.lists import get_sympa_client
from tfjm.matrix import Matrix
from tfjm.views import AdminMixin
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
@ -22,6 +19,9 @@ from django.views.generic.edit import FormMixin, ProcessFormView
from django_tables2 import SingleTableView from django_tables2 import SingleTableView
from magic import Magic from magic import Magic
from registration.models import AdminRegistration from registration.models import AdminRegistration
from tfjm.lists import get_sympa_client
from tfjm.matrix import Matrix
from tfjm.views import AdminMixin
from .forms import JoinTeamForm, ParticipationForm, RequestValidationForm, TeamForm, ValidateParticipationForm from .forms import JoinTeamForm, ParticipationForm, RequestValidationForm, TeamForm, ValidateParticipationForm
from .models import Participation, Team from .models import Participation, Team

View File

@ -1,7 +1,6 @@
# Copyright (C) 2020 by Animath # Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from tfjm.tokens import email_validation_token
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.db import models from django.db import models
from django.template import loader from django.template import loader
@ -11,6 +10,7 @@ from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode from django.utils.http import urlsafe_base64_encode
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from polymorphic.models import PolymorphicModel from polymorphic.models import PolymorphicModel
from tfjm.tokens import email_validation_token
class Registration(PolymorphicModel): class Registration(PolymorphicModel):

View File

@ -1,9 +1,9 @@
# Copyright (C) 2020 by Animath # Copyright (C) 2020 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from django.contrib.auth.models import User
from tfjm.lists import get_sympa_client from tfjm.lists import get_sympa_client
from tfjm.matrix import Matrix from tfjm.matrix import Matrix
from django.contrib.auth.models import User
from .models import AdminRegistration, Registration from .models import AdminRegistration, Registration

View File

@ -4,7 +4,7 @@
from django import template from django import template
from django_tables2 import Table from django_tables2 import Table
from participation.models import Participation, Team from participation.models import Participation, Team
from participation.tables import ParticipationTable, TeamTable, VideoTable from participation.tables import ParticipationTable, TeamTable
from ..models import Registration from ..models import Registration
from ..tables import RegistrationTable from ..tables import RegistrationTable

View File

@ -3,7 +3,6 @@
import os import os
from tfjm.tokens import email_validation_token
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
@ -14,6 +13,7 @@ from django.urls import reverse
from django.utils.encoding import force_bytes from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode from django.utils.http import urlsafe_base64_encode
from participation.models import Team from participation.models import Team
from tfjm.tokens import email_validation_token
from .models import AdminRegistration, CoachRegistration, StudentRegistration from .models import AdminRegistration, CoachRegistration, StudentRegistration

View File

@ -3,8 +3,6 @@
import os import os
from tfjm.tokens import email_validation_token
from tfjm.views import AdminMixin
from django.conf import settings from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User from django.contrib.auth.models import User
@ -18,6 +16,8 @@ from django.utils.translation import gettext_lazy as _
from django.views.generic import CreateView, DetailView, RedirectView, TemplateView, UpdateView, View from django.views.generic import CreateView, DetailView, RedirectView, TemplateView, UpdateView, View
from django_tables2 import SingleTableView from django_tables2 import SingleTableView
from magic import Magic from magic import Magic
from tfjm.tokens import email_validation_token
from tfjm.views import AdminMixin
from .forms import CoachRegistrationForm, PhotoAuthorizationForm, SignupForm, StudentRegistrationForm, UserForm from .forms import CoachRegistrationForm, PhotoAuthorizationForm, SignupForm, StudentRegistrationForm, UserForm
from .models import Registration, StudentRegistration from .models import Registration, StudentRegistration

View File

@ -68,7 +68,7 @@ INSTALLED_APPS = [
'participation', 'participation',
] ]
if "test" not in sys.argv and not "makemigrations" in sys.argv: # pragma: no cover if "test" not in sys.argv and "makemigrations" not in sys.argv: # pragma: no cover
INSTALLED_APPS += [ INSTALLED_APPS += [
'cas_server', 'cas_server',
'django_extensions', 'django_extensions',