From 7628387158369e72b0779806a65bef0bfef68979 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Thu, 24 Dec 2020 00:43:07 +0100 Subject: [PATCH 1/8] Fix the fix of the sympa lists --- apps/participation/management/commands/fix_sympa_lists.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/participation/management/commands/fix_sympa_lists.py b/apps/participation/management/commands/fix_sympa_lists.py index 63152b5..b4a43d3 100644 --- a/apps/participation/management/commands/fix_sympa_lists.py +++ b/apps/participation/management/commands/fix_sympa_lists.py @@ -26,10 +26,12 @@ class Command(BaseCommand): f" des Correspondances.", "education", raise_error=False) for team in Team.objects.filter(participation__valid=True).all(): - sympa.subscribe(team.email, "equipes", f"Equipe {team.name}", True, True) + team.create_mailing_list() + sympa.subscribe(team.email, "equipes", f"Equipe {team.name}", True) sympa.subscribe(team.email, f"probleme-{team.participation.problem}", f"Equipe {team.name}", True) for team in Team.objects.filter(Q(participation__valid=False) | Q(participation__valid__isnull=True)).all(): + team.create_mailing_list() sympa.subscribe(team.email, "equipes-non-valides", f"Equipe {team.name}", True) for student in StudentRegistration.objects.filter(team__isnull=False).all(): From 8f86ea15c82e1f408af162ef366d2ad9e3adada7 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 26 Dec 2020 19:24:37 +0100 Subject: [PATCH 2/8] Pending teams can change their composition --- apps/participation/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/participation/views.py b/apps/participation/views.py index 34e2cf0..8789d31 100644 --- a/apps/participation/views.py +++ b/apps/participation/views.py @@ -341,7 +341,7 @@ class TeamLeaveView(LoginRequiredMixin, TemplateView): return self.handle_no_permission() if not request.user.registration.participates or not request.user.registration.team: raise PermissionDenied(_("You are not in a team.")) - if request.user.registration.team.participation.valid is not None: + if request.user.registration.team.participation.valid: raise PermissionDenied(_("The team is already validated or the validation is pending.")) return super().dispatch(request, *args, **kwargs) From 02c977264d58cbb4959acfd2030ea37e8060f798 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 26 Dec 2020 19:43:46 +0100 Subject: [PATCH 3/8] Pending teams can change their composition --- apps/participation/tests.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/apps/participation/tests.py b/apps/participation/tests.py index 82a0309..b1ebf96 100644 --- a/apps/participation/tests.py +++ b/apps/participation/tests.py @@ -409,12 +409,6 @@ class TestStudentParticipation(TestCase): self.user.registration.team = self.team self.user.registration.save() - # Team is pending validation - self.team.participation.valid = False - self.team.participation.save() - response = self.client.post(reverse("participation:team_leave")) - self.assertEqual(response.status_code, 403) - # Team is valid self.team.participation.valid = True self.team.participation.save() From 64d471936f1bde71a42a15eb276ee11530a9408c Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 26 Dec 2020 21:26:26 +0100 Subject: [PATCH 4/8] Add copyright information --- LICENSE | 4 ++-- apps/api/__init__.py | 3 +++ apps/api/apps.py | 3 +++ apps/api/serializers.py | 3 +++ apps/api/tests.py | 3 +++ apps/api/urls.py | 3 +++ apps/api/viewsets.py | 3 +++ apps/eastereggs/__init__.py | 3 +++ apps/eastereggs/apps.py | 3 +++ apps/eastereggs/migrations/__init__.py | 2 ++ apps/eastereggs/urls.py | 3 +++ apps/logs/api/__init__.py | 2 ++ apps/logs/migrations/__init__.py | 2 ++ apps/participation/__init__.py | 3 +++ apps/participation/admin.py | 3 +++ apps/participation/apps.py | 3 +++ apps/participation/forms.py | 3 +++ apps/participation/management/commands/__init__.py | 2 ++ apps/participation/management/commands/fix_matrix_channels.py | 3 +++ apps/participation/management/commands/fix_sympa_lists.py | 3 +++ apps/participation/management/commands/setup_third_phase.py | 3 +++ apps/participation/migrations/__init__.py | 2 ++ apps/participation/models.py | 3 +++ apps/participation/search_indexes.py | 3 +++ apps/participation/signals.py | 3 +++ apps/participation/tables.py | 3 +++ apps/participation/templatetags/__init__.py | 2 ++ apps/participation/templatetags/calendar.py | 3 +++ apps/participation/tests.py | 3 +++ apps/participation/urls.py | 3 +++ apps/participation/views.py | 3 +++ apps/registration/__init__.py | 3 +++ apps/registration/admin.py | 3 +++ apps/registration/apps.py | 3 +++ apps/registration/auth.py | 3 +++ apps/registration/forms.py | 3 +++ apps/registration/migrations/__init__.py | 2 ++ apps/registration/models.py | 3 +++ apps/registration/search_indexes.py | 3 +++ apps/registration/signals.py | 3 +++ apps/registration/tables.py | 3 +++ apps/registration/templatetags/__init__.py | 2 ++ apps/registration/templatetags/search_results_tables.py | 3 +++ apps/registration/tests.py | 3 +++ apps/registration/urls.py | 3 +++ apps/registration/views.py | 3 +++ corres2math/__init__.py | 2 ++ corres2math/asgi.py | 3 +++ corres2math/lists.py | 3 +++ corres2math/matrix.py | 3 +++ corres2math/middlewares.py | 3 +++ corres2math/settings.py | 3 +++ corres2math/settings_dev.py | 3 +++ corres2math/settings_prod.py | 3 +++ corres2math/tests.py | 3 +++ corres2math/tokens.py | 3 +++ corres2math/urls.py | 3 +++ corres2math/views.py | 3 +++ corres2math/wsgi.py | 3 +++ 59 files changed, 167 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index f288702..be948b1 100644 --- a/LICENSE +++ b/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - Copyright (C) + Copyright (C) 2020 Animath This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - Copyright (C) + Copyright (C) 2020 Animath This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/apps/api/__init__.py b/apps/api/__init__.py index 08884cb..240eb6e 100644 --- a/apps/api/__init__.py +++ b/apps/api/__init__.py @@ -1 +1,4 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + default_app_config = 'api.apps.APIConfig' diff --git a/apps/api/apps.py b/apps/api/apps.py index 6e03468..1392dc1 100644 --- a/apps/api/apps.py +++ b/apps/api/apps.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.apps import AppConfig from django.utils.translation import gettext_lazy as _ diff --git a/apps/api/serializers.py b/apps/api/serializers.py index 0b364e0..cbd843d 100644 --- a/apps/api/serializers.py +++ b/apps/api/serializers.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.contrib.auth.models import User from rest_framework import serializers diff --git a/apps/api/tests.py b/apps/api/tests.py index 149a76d..7c744fa 100644 --- a/apps/api/tests.py +++ b/apps/api/tests.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from unittest.case import skipIf from django.conf import settings diff --git a/apps/api/urls.py b/apps/api/urls.py index 982085a..410fa86 100644 --- a/apps/api/urls.py +++ b/apps/api/urls.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.conf import settings from django.conf.urls import include, url from rest_framework import routers diff --git a/apps/api/viewsets.py b/apps/api/viewsets.py index 757993d..5c1a621 100644 --- a/apps/api/viewsets.py +++ b/apps/api/viewsets.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.contrib.auth.models import User from django_filters.rest_framework import DjangoFilterBackend from rest_framework.filters import SearchFilter diff --git a/apps/eastereggs/__init__.py b/apps/eastereggs/__init__.py index f5d007b..5bed298 100644 --- a/apps/eastereggs/__init__.py +++ b/apps/eastereggs/__init__.py @@ -1 +1,4 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + default_app_config = 'eastereggs.apps.EastereggsConfig' diff --git a/apps/eastereggs/apps.py b/apps/eastereggs/apps.py index 93a00a2..afe5de2 100644 --- a/apps/eastereggs/apps.py +++ b/apps/eastereggs/apps.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.apps import AppConfig diff --git a/apps/eastereggs/migrations/__init__.py b/apps/eastereggs/migrations/__init__.py index e69de29..dfc9706 100644 --- a/apps/eastereggs/migrations/__init__.py +++ b/apps/eastereggs/migrations/__init__.py @@ -0,0 +1,2 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/apps/eastereggs/urls.py b/apps/eastereggs/urls.py index 64200f1..de4d195 100644 --- a/apps/eastereggs/urls.py +++ b/apps/eastereggs/urls.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.urls import path from django.views.generic import TemplateView diff --git a/apps/logs/api/__init__.py b/apps/logs/api/__init__.py index e69de29..4e945ad 100644 --- a/apps/logs/api/__init__.py +++ b/apps/logs/api/__init__.py @@ -0,0 +1,2 @@ +# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/apps/logs/migrations/__init__.py b/apps/logs/migrations/__init__.py index e69de29..cf6bcc8 100644 --- a/apps/logs/migrations/__init__.py +++ b/apps/logs/migrations/__init__.py @@ -0,0 +1,2 @@ +# Copyright (C) 2020 by BDE ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/apps/participation/__init__.py b/apps/participation/__init__.py index e784201..fe068b6 100644 --- a/apps/participation/__init__.py +++ b/apps/participation/__init__.py @@ -1 +1,4 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + default_app_config = 'participation.apps.ParticipationConfig' diff --git a/apps/participation/admin.py b/apps/participation/admin.py index e4b3953..25bbdcc 100644 --- a/apps/participation/admin.py +++ b/apps/participation/admin.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.contrib import admin from django.utils.translation import gettext_lazy as _ diff --git a/apps/participation/apps.py b/apps/participation/apps.py index e775176..e76d270 100644 --- a/apps/participation/apps.py +++ b/apps/participation/apps.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.apps import AppConfig from django.db.models.signals import post_save, pre_delete, pre_save diff --git a/apps/participation/forms.py b/apps/participation/forms.py index 605601c..6ec054f 100644 --- a/apps/participation/forms.py +++ b/apps/participation/forms.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + import re from bootstrap_datepicker_plus import DateTimePickerInput diff --git a/apps/participation/management/commands/__init__.py b/apps/participation/management/commands/__init__.py index e69de29..dfc9706 100644 --- a/apps/participation/management/commands/__init__.py +++ b/apps/participation/management/commands/__init__.py @@ -0,0 +1,2 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/apps/participation/management/commands/fix_matrix_channels.py b/apps/participation/management/commands/fix_matrix_channels.py index 7ce878c..274475d 100644 --- a/apps/participation/management/commands/fix_matrix_channels.py +++ b/apps/participation/management/commands/fix_matrix_channels.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + import os from asgiref.sync import async_to_sync diff --git a/apps/participation/management/commands/fix_sympa_lists.py b/apps/participation/management/commands/fix_sympa_lists.py index b4a43d3..9b335e7 100644 --- a/apps/participation/management/commands/fix_sympa_lists.py +++ b/apps/participation/management/commands/fix_sympa_lists.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from corres2math.lists import get_sympa_client from django.core.management import BaseCommand from django.db.models import Q diff --git a/apps/participation/management/commands/setup_third_phase.py b/apps/participation/management/commands/setup_third_phase.py index 3034354..ea485a9 100644 --- a/apps/participation/management/commands/setup_third_phase.py +++ b/apps/participation/management/commands/setup_third_phase.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from corres2math.matrix import Matrix, RoomVisibility from django.core.management import BaseCommand from participation.models import Participation diff --git a/apps/participation/migrations/__init__.py b/apps/participation/migrations/__init__.py index e69de29..dfc9706 100644 --- a/apps/participation/migrations/__init__.py +++ b/apps/participation/migrations/__init__.py @@ -0,0 +1,2 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/apps/participation/models.py b/apps/participation/models.py index 55e808c..f83fd98 100644 --- a/apps/participation/models.py +++ b/apps/participation/models.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + import os import re diff --git a/apps/participation/search_indexes.py b/apps/participation/search_indexes.py index 734d5bb..22e722a 100644 --- a/apps/participation/search_indexes.py +++ b/apps/participation/search_indexes.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from haystack import indexes from .models import Participation, Team, Video diff --git a/apps/participation/signals.py b/apps/participation/signals.py index 67998d9..45a8368 100644 --- a/apps/participation/signals.py +++ b/apps/participation/signals.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from corres2math.lists import get_sympa_client from participation.models import Participation, Team, Video diff --git a/apps/participation/tables.py b/apps/participation/tables.py index 1473b68..cfd121f 100644 --- a/apps/participation/tables.py +++ b/apps/participation/tables.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.utils import timezone from django.utils.translation import gettext_lazy as _ import django_tables2 as tables diff --git a/apps/participation/templatetags/__init__.py b/apps/participation/templatetags/__init__.py index e69de29..dfc9706 100644 --- a/apps/participation/templatetags/__init__.py +++ b/apps/participation/templatetags/__init__.py @@ -0,0 +1,2 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/apps/participation/templatetags/calendar.py b/apps/participation/templatetags/calendar.py index 62cc0aa..0a8477b 100644 --- a/apps/participation/templatetags/calendar.py +++ b/apps/participation/templatetags/calendar.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django import template from ..models import Phase diff --git a/apps/participation/tests.py b/apps/participation/tests.py index b1ebf96..8c30e45 100644 --- a/apps/participation/tests.py +++ b/apps/participation/tests.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from datetime import timedelta from django.contrib.auth.models import User diff --git a/apps/participation/urls.py b/apps/participation/urls.py index f36d8a5..7e6d3fe 100644 --- a/apps/participation/urls.py +++ b/apps/participation/urls.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.urls import path from django.views.generic import TemplateView diff --git a/apps/participation/views.py b/apps/participation/views.py index 8789d31..d68ea42 100644 --- a/apps/participation/views.py +++ b/apps/participation/views.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from io import BytesIO from zipfile import ZipFile diff --git a/apps/registration/__init__.py b/apps/registration/__init__.py index 7e6a996..6d49a03 100644 --- a/apps/registration/__init__.py +++ b/apps/registration/__init__.py @@ -1 +1,4 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + default_app_config = 'registration.apps.RegistrationConfig' diff --git a/apps/registration/admin.py b/apps/registration/admin.py index edc257a..de6c4a1 100644 --- a/apps/registration/admin.py +++ b/apps/registration/admin.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.contrib import admin from polymorphic.admin import PolymorphicChildModelAdmin, PolymorphicParentModelAdmin diff --git a/apps/registration/apps.py b/apps/registration/apps.py index a6d9ede..929e8ff 100644 --- a/apps/registration/apps.py +++ b/apps/registration/apps.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.apps import AppConfig from django.db.models.signals import post_save, pre_save diff --git a/apps/registration/auth.py b/apps/registration/auth.py index f84b1f0..78b0a84 100644 --- a/apps/registration/auth.py +++ b/apps/registration/auth.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from cas_server.auth import DjangoAuthUser # pragma: no cover diff --git a/apps/registration/forms.py b/apps/registration/forms.py index 5c4aec3..80531d7 100644 --- a/apps/registration/forms.py +++ b/apps/registration/forms.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User diff --git a/apps/registration/migrations/__init__.py b/apps/registration/migrations/__init__.py index e69de29..dfc9706 100644 --- a/apps/registration/migrations/__init__.py +++ b/apps/registration/migrations/__init__.py @@ -0,0 +1,2 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/apps/registration/models.py b/apps/registration/models.py index 0a85dc6..fd18f90 100644 --- a/apps/registration/models.py +++ b/apps/registration/models.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from corres2math.tokens import email_validation_token from django.contrib.sites.models import Site from django.db import models diff --git a/apps/registration/search_indexes.py b/apps/registration/search_indexes.py index d52ce87..3457298 100644 --- a/apps/registration/search_indexes.py +++ b/apps/registration/search_indexes.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from haystack import indexes from .models import Registration diff --git a/apps/registration/signals.py b/apps/registration/signals.py index 0a6edec..6b0fe56 100644 --- a/apps/registration/signals.py +++ b/apps/registration/signals.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from corres2math.lists import get_sympa_client from corres2math.matrix import Matrix from django.contrib.auth.models import User diff --git a/apps/registration/tables.py b/apps/registration/tables.py index 7995ade..7f18bd5 100644 --- a/apps/registration/tables.py +++ b/apps/registration/tables.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.utils.translation import gettext_lazy as _ import django_tables2 as tables diff --git a/apps/registration/templatetags/__init__.py b/apps/registration/templatetags/__init__.py index e69de29..dfc9706 100644 --- a/apps/registration/templatetags/__init__.py +++ b/apps/registration/templatetags/__init__.py @@ -0,0 +1,2 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/apps/registration/templatetags/search_results_tables.py b/apps/registration/templatetags/search_results_tables.py index 18825e8..f80a2ac 100644 --- a/apps/registration/templatetags/search_results_tables.py +++ b/apps/registration/templatetags/search_results_tables.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django import template from django_tables2 import Table from participation.models import Participation, Team, Video diff --git a/apps/registration/tests.py b/apps/registration/tests.py index 4f3ff34..acf3cb3 100644 --- a/apps/registration/tests.py +++ b/apps/registration/tests.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from datetime import timedelta import os diff --git a/apps/registration/urls.py b/apps/registration/urls.py index 804036c..7d6bf01 100644 --- a/apps/registration/urls.py +++ b/apps/registration/urls.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.urls import path from .views import MyAccountDetailView, ResetAdminView, SignupView, UserDetailView, UserImpersonateView, \ diff --git a/apps/registration/views.py b/apps/registration/views.py index a0efeeb..c9cacbe 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + import os from corres2math.tokens import email_validation_token diff --git a/corres2math/__init__.py b/corres2math/__init__.py index e69de29..dfc9706 100644 --- a/corres2math/__init__.py +++ b/corres2math/__init__.py @@ -0,0 +1,2 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/corres2math/asgi.py b/corres2math/asgi.py index 949b8bb..bc322ac 100644 --- a/corres2math/asgi.py +++ b/corres2math/asgi.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + """ ASGI config for corres2math project. diff --git a/corres2math/lists.py b/corres2math/lists.py index d224392..667d372 100644 --- a/corres2math/lists.py +++ b/corres2math/lists.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + import os _client = None diff --git a/corres2math/matrix.py b/corres2math/matrix.py index a6265a9..506c01f 100644 --- a/corres2math/matrix.py +++ b/corres2math/matrix.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from enum import Enum import os diff --git a/corres2math/middlewares.py b/corres2math/middlewares.py index 40cc04d..c26c733 100644 --- a/corres2math/middlewares.py +++ b/corres2math/middlewares.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from threading import local from django.conf import settings diff --git a/corres2math/settings.py b/corres2math/settings.py index 7f1e52b..bce56e1 100644 --- a/corres2math/settings.py +++ b/corres2math/settings.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + """ Django settings for corres2math project. diff --git a/corres2math/settings_dev.py b/corres2math/settings_dev.py index bf6e856..e20ecbb 100644 --- a/corres2math/settings_dev.py +++ b/corres2math/settings_dev.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + # Database # https://docs.djangoproject.com/en/3.0/ref/settings/#databases diff --git a/corres2math/settings_prod.py b/corres2math/settings_prod.py index 539eb41..ce56c78 100644 --- a/corres2math/settings_prod.py +++ b/corres2math/settings_prod.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + import os # Break it, fix it! diff --git a/corres2math/tests.py b/corres2math/tests.py index c4337de..3b67da8 100644 --- a/corres2math/tests.py +++ b/corres2math/tests.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + import os from django.core.handlers.asgi import ASGIHandler diff --git a/corres2math/tokens.py b/corres2math/tokens.py index a945253..e0b4b33 100644 --- a/corres2math/tokens.py +++ b/corres2math/tokens.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + from django.contrib.auth.tokens import PasswordResetTokenGenerator diff --git a/corres2math/urls.py b/corres2math/urls.py index 910f4eb..9109f04 100644 --- a/corres2math/urls.py +++ b/corres2math/urls.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + """corres2math URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: diff --git a/corres2math/views.py b/corres2math/views.py index c777822..c858a73 100644 --- a/corres2math/views.py +++ b/corres2math/views.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# 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 diff --git a/corres2math/wsgi.py b/corres2math/wsgi.py index 0cae477..ab878ce 100644 --- a/corres2math/wsgi.py +++ b/corres2math/wsgi.py @@ -1,3 +1,6 @@ +# Copyright (C) 2020 by Animath +# SPDX-License-Identifier: GPL-3.0-or-later + """ WSGI config for corres2math project. From eec941c816d5c2aa7c7aea90300fd53ded865cd9 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 27 Dec 2020 21:19:09 +0100 Subject: [PATCH 5/8] Admins can change email validation status --- apps/registration/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/registration/views.py b/apps/registration/views.py index c9cacbe..84bf345 100644 --- a/apps/registration/views.py +++ b/apps/registration/views.py @@ -213,7 +213,7 @@ class UserUpdateView(LoginRequiredMixin, UpdateView): context["title"] = _("Update user {user}").format(user=str(self.object.registration)) context["registration_form"] = user.registration.form_class(data=self.request.POST or None, instance=self.object.registration) - if not user.registration.is_admin: + if not self.request.user.registration.is_admin: if "team" in context["registration_form"].fields: del context["registration_form"].fields["team"] del context["registration_form"].fields["email_confirmed"] @@ -224,7 +224,7 @@ class UserUpdateView(LoginRequiredMixin, UpdateView): user = form.instance registration_form = user.registration.form_class(data=self.request.POST or None, instance=self.object.registration) - if not user.registration.is_admin: + if not self.request.user.registration.is_admin: if "team" in registration_form.fields: del registration_form.fields["team"] del registration_form.fields["email_confirmed"] From 95a69f35d2ac524cd3776bd6526037fd24311571 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 28 Dec 2020 11:52:34 +0100 Subject: [PATCH 6/8] A user can have no team --- apps/registration/migrations/0001_initial.py | 4 ++-- apps/registration/models.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/registration/migrations/0001_initial.py b/apps/registration/migrations/0001_initial.py index 37baf8d..a578fe9 100644 --- a/apps/registration/migrations/0001_initial.py +++ b/apps/registration/migrations/0001_initial.py @@ -50,7 +50,7 @@ class Migration(migrations.Migration): ('student_class', models.IntegerField(choices=[(12, '12th grade'), (11, '11th grade'), (10, '10th grade or lower')], verbose_name='student class')), ('school', models.CharField(max_length=255, verbose_name='school')), ('photo_authorization', models.FileField(blank=True, default='', upload_to=registration.models.get_random_filename, verbose_name='photo authorization')), - ('team', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='students', to='participation.team', verbose_name='team')), + ('team', models.ForeignKey(default=None, blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='students', to='participation.team', verbose_name='team')), ], options={ 'verbose_name': 'student registration', @@ -63,7 +63,7 @@ class Migration(migrations.Migration): fields=[ ('registration_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='registration.registration')), ('professional_activity', models.TextField(verbose_name='professional activity')), - ('team', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='coachs', to='participation.team', verbose_name='team')), + ('team', models.ForeignKey(default=None, blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='coachs', to='participation.team', verbose_name='team')), ], options={ 'verbose_name': 'coach registration', diff --git a/apps/registration/models.py b/apps/registration/models.py index fd18f90..e33ec4a 100644 --- a/apps/registration/models.py +++ b/apps/registration/models.py @@ -105,6 +105,7 @@ class StudentRegistration(Registration): related_name="students", on_delete=models.PROTECT, null=True, + blank=True, default=None, verbose_name=_("team"), ) @@ -154,6 +155,7 @@ class CoachRegistration(Registration): related_name="coachs", on_delete=models.PROTECT, null=True, + blank=True, default=None, verbose_name=_("team"), ) From bcdbc445c63f7daf05091419f91801d6c769a797 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 1 Jan 2021 15:41:23 +0100 Subject: [PATCH 7/8] Fix the fix sympa lists script --- apps/participation/management/commands/fix_sympa_lists.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/participation/management/commands/fix_sympa_lists.py b/apps/participation/management/commands/fix_sympa_lists.py index 9b335e7..ff0c1f0 100644 --- a/apps/participation/management/commands/fix_sympa_lists.py +++ b/apps/participation/management/commands/fix_sympa_lists.py @@ -38,6 +38,6 @@ class Command(BaseCommand): sympa.subscribe(team.email, "equipes-non-valides", f"Equipe {team.name}", True) for student in StudentRegistration.objects.filter(team__isnull=False).all(): - sympa.subscribe(student.user.email, f"equipe-{student.team.trigram.lower}", True, f"{student}") + sympa.subscribe(student.user.email, f"equipe-{student.team.trigram.lower()}", True, f"{student}") for coach in CoachRegistration.objects.filter(team__isnull=False).all(): - sympa.subscribe(coach.user.email, f"equipe-{coach.team.trigram.lower}", True, f"{coach}") + sympa.subscribe(coach.user.email, f"equipe-{coach.team.trigram.lower()}", True, f"{coach}") From d55671efd1af1e8eadce71e9406f81038801b537 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 1 Jan 2021 15:54:50 +0100 Subject: [PATCH 8/8] Use warning background for teams that didn't sent their video --- apps/participation/tables.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/participation/tables.py b/apps/participation/tables.py index cfd121f..b8f3a93 100644 --- a/apps/participation/tables.py +++ b/apps/participation/tables.py @@ -42,6 +42,9 @@ class TeamTable(tables.Table): attrs = { 'class': 'table table condensed table-striped', } + row_attrs = { + 'class': lambda record: '' if record.participation.solution.link else 'bg-warning', + } model = Team fields = ('name', 'trigram', 'problem',) template_name = 'django_tables2/bootstrap4.html'