mirror of
				https://gitlab.com/animath/si/plateforme-corres2math.git
				synced 2025-10-31 17:00:04 +01:00 
			
		
		
		
	Compare commits
	
		
			9 Commits
		
	
	
		
			a82c6b4673
			...
			01f6d74cae
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 01f6d74cae | ||
|  | d55671efd1 | ||
|  | bcdbc445c6 | ||
|  | 95a69f35d2 | ||
|  | eec941c816 | ||
|  | 64d471936f | ||
|  | 02c977264d | ||
|  | 8f86ea15c8 | ||
|  | 7628387158 | 
							
								
								
									
										4
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								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. | the "copyright" line and a pointer to where the full notice is found. | ||||||
|  |  | ||||||
|     <one line to give the program's name and a brief idea of what it does.> |     <one line to give the program's name and a brief idea of what it does.> | ||||||
|     Copyright (C) <year>  <name of author> |     Copyright (C) 2020  Animath | ||||||
|  |  | ||||||
|     This program is free software: you can redistribute it and/or modify |     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 |     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 |   If the program does terminal interaction, make it output a short | ||||||
| notice like this when it starts in an interactive mode: | notice like this when it starts in an interactive mode: | ||||||
|  |  | ||||||
|     <program>  Copyright (C) <year>  <name of author> |     <program>  Copyright (C) 2020  Animath | ||||||
|     This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |     This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | ||||||
|     This is free software, and you are welcome to redistribute it |     This is free software, and you are welcome to redistribute it | ||||||
|     under certain conditions; type `show c' for details. |     under certain conditions; type `show c' for details. | ||||||
|   | |||||||
| @@ -1 +1,4 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| default_app_config = 'api.apps.APIConfig' | default_app_config = 'api.apps.APIConfig' | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from django.apps import AppConfig | from django.apps import AppConfig | ||||||
| from django.utils.translation import gettext_lazy as _ | from django.utils.translation import gettext_lazy as _ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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.contrib.auth.models import User | ||||||
| from rest_framework import serializers | from rest_framework import serializers | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from unittest.case import skipIf | from unittest.case import skipIf | ||||||
|  |  | ||||||
| from django.conf import settings | from django.conf import settings | ||||||
|   | |||||||
| @@ -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 import settings | ||||||
| from django.conf.urls import include, url | from django.conf.urls import include, url | ||||||
| from rest_framework import routers | from rest_framework import routers | ||||||
|   | |||||||
| @@ -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.contrib.auth.models import User | ||||||
| from django_filters.rest_framework import DjangoFilterBackend | from django_filters.rest_framework import DjangoFilterBackend | ||||||
| from rest_framework.filters import SearchFilter | from rest_framework.filters import SearchFilter | ||||||
|   | |||||||
| @@ -1 +1,4 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| default_app_config = 'eastereggs.apps.EastereggsConfig' | default_app_config = 'eastereggs.apps.EastereggsConfig' | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from django.apps import AppConfig | from django.apps import AppConfig | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from django.urls import path | from django.urls import path | ||||||
| from django.views.generic import TemplateView | from django.views.generic import TemplateView | ||||||
|  |  | ||||||
|   | |||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | # Copyright (C) 2018-2020 by BDE ENS Paris-Saclay | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|   | |||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | # Copyright (C) 2020 by BDE ENS Paris-Saclay | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|   | |||||||
| @@ -1 +1,4 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| default_app_config = 'participation.apps.ParticipationConfig' | default_app_config = 'participation.apps.ParticipationConfig' | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from django.contrib import admin | from django.contrib import admin | ||||||
| from django.utils.translation import gettext_lazy as _ | from django.utils.translation import gettext_lazy as _ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # 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_delete, pre_save | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| import re | import re | ||||||
|  |  | ||||||
| from bootstrap_datepicker_plus import DateTimePickerInput | from bootstrap_datepicker_plus import DateTimePickerInput | ||||||
|   | |||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| import os | import os | ||||||
|  |  | ||||||
| from asgiref.sync import async_to_sync | from asgiref.sync import async_to_sync | ||||||
|   | |||||||
| @@ -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.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 | ||||||
| @@ -26,13 +29,15 @@ class Command(BaseCommand): | |||||||
|                               f" des Correspondances.", "education", raise_error=False) |                               f" des Correspondances.", "education", raise_error=False) | ||||||
|  |  | ||||||
|         for team in Team.objects.filter(participation__valid=True).all(): |         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) |             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(): |         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) |             sympa.subscribe(team.email, "equipes-non-valides", f"Equipe {team.name}", True) | ||||||
|  |  | ||||||
|         for student in StudentRegistration.objects.filter(team__isnull=False).all(): |         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(): |         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}") | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from corres2math.matrix import Matrix, RoomVisibility | from corres2math.matrix import Matrix, RoomVisibility | ||||||
| from django.core.management import BaseCommand | from django.core.management import BaseCommand | ||||||
| from participation.models import Participation | from participation.models import Participation | ||||||
|   | |||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| import os | import os | ||||||
| import re | import re | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from haystack import indexes | from haystack import indexes | ||||||
|  |  | ||||||
| from .models import Participation, Team, Video | from .models import Participation, Team, Video | ||||||
|   | |||||||
| @@ -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.lists import get_sympa_client | ||||||
| from participation.models import Participation, Team, Video | from participation.models import Participation, Team, Video | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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 import timezone | ||||||
| from django.utils.translation import gettext_lazy as _ | from django.utils.translation import gettext_lazy as _ | ||||||
| import django_tables2 as tables | import django_tables2 as tables | ||||||
| @@ -39,6 +42,9 @@ class TeamTable(tables.Table): | |||||||
|         attrs = { |         attrs = { | ||||||
|             'class': 'table table condensed table-striped', |             'class': 'table table condensed table-striped', | ||||||
|         } |         } | ||||||
|  |         row_attrs = { | ||||||
|  |             'class': lambda record: '' if record.participation.solution.link else 'bg-warning', | ||||||
|  |         } | ||||||
|         model = Team |         model = Team | ||||||
|         fields = ('name', 'trigram', 'problem',) |         fields = ('name', 'trigram', 'problem',) | ||||||
|         template_name = 'django_tables2/bootstrap4.html' |         template_name = 'django_tables2/bootstrap4.html' | ||||||
|   | |||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from django import template | from django import template | ||||||
|  |  | ||||||
| from ..models import Phase | from ..models import Phase | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from datetime import timedelta | from datetime import timedelta | ||||||
|  |  | ||||||
| from django.contrib.auth.models import User | from django.contrib.auth.models import User | ||||||
| @@ -409,12 +412,6 @@ class TestStudentParticipation(TestCase): | |||||||
|         self.user.registration.team = self.team |         self.user.registration.team = self.team | ||||||
|         self.user.registration.save() |         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 |         # Team is valid | ||||||
|         self.team.participation.valid = True |         self.team.participation.valid = True | ||||||
|         self.team.participation.save() |         self.team.participation.save() | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from django.urls import path | from django.urls import path | ||||||
| from django.views.generic import TemplateView | from django.views.generic import TemplateView | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from io import BytesIO | from io import BytesIO | ||||||
| from zipfile import ZipFile | from zipfile import ZipFile | ||||||
|  |  | ||||||
| @@ -341,7 +344,7 @@ class TeamLeaveView(LoginRequiredMixin, TemplateView): | |||||||
|             return self.handle_no_permission() |             return self.handle_no_permission() | ||||||
|         if not request.user.registration.participates or not request.user.registration.team: |         if not request.user.registration.participates or not request.user.registration.team: | ||||||
|             raise PermissionDenied(_("You are not in a 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.")) |             raise PermissionDenied(_("The team is already validated or the validation is pending.")) | ||||||
|         return super().dispatch(request, *args, **kwargs) |         return super().dispatch(request, *args, **kwargs) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1 +1,4 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| default_app_config = 'registration.apps.RegistrationConfig' | default_app_config = 'registration.apps.RegistrationConfig' | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from django.contrib import admin | from django.contrib import admin | ||||||
| from polymorphic.admin import PolymorphicChildModelAdmin, PolymorphicParentModelAdmin | from polymorphic.admin import PolymorphicChildModelAdmin, PolymorphicParentModelAdmin | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # 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_save | from django.db.models.signals import post_save, pre_save | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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 | from cas_server.auth import DjangoAuthUser  # pragma: no cover | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from django import forms | from django import forms | ||||||
| from django.contrib.auth.forms import UserCreationForm | from django.contrib.auth.forms import UserCreationForm | ||||||
| from django.contrib.auth.models import User | from django.contrib.auth.models import User | ||||||
|   | |||||||
| @@ -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')), |                 ('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')), |                 ('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')), |                 ('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={ |             options={ | ||||||
|                 'verbose_name': 'student registration', |                 'verbose_name': 'student registration', | ||||||
| @@ -63,7 +63,7 @@ class Migration(migrations.Migration): | |||||||
|             fields=[ |             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')), |                 ('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')), |                 ('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={ |             options={ | ||||||
|                 'verbose_name': 'coach registration', |                 'verbose_name': 'coach registration', | ||||||
|   | |||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|   | |||||||
| @@ -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 corres2math.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 | ||||||
| @@ -102,6 +105,7 @@ class StudentRegistration(Registration): | |||||||
|         related_name="students", |         related_name="students", | ||||||
|         on_delete=models.PROTECT, |         on_delete=models.PROTECT, | ||||||
|         null=True, |         null=True, | ||||||
|  |         blank=True, | ||||||
|         default=None, |         default=None, | ||||||
|         verbose_name=_("team"), |         verbose_name=_("team"), | ||||||
|     ) |     ) | ||||||
| @@ -151,6 +155,7 @@ class CoachRegistration(Registration): | |||||||
|         related_name="coachs", |         related_name="coachs", | ||||||
|         on_delete=models.PROTECT, |         on_delete=models.PROTECT, | ||||||
|         null=True, |         null=True, | ||||||
|  |         blank=True, | ||||||
|         default=None, |         default=None, | ||||||
|         verbose_name=_("team"), |         verbose_name=_("team"), | ||||||
|     ) |     ) | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from haystack import indexes | from haystack import indexes | ||||||
|  |  | ||||||
| from .models import Registration | from .models import Registration | ||||||
|   | |||||||
| @@ -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.lists import get_sympa_client | ||||||
| from corres2math.matrix import Matrix | from corres2math.matrix import Matrix | ||||||
| from django.contrib.auth.models import User | from django.contrib.auth.models import User | ||||||
|   | |||||||
| @@ -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 _ | from django.utils.translation import gettext_lazy as _ | ||||||
| import django_tables2 as tables | import django_tables2 as tables | ||||||
|  |  | ||||||
|   | |||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from django import template | from django import template | ||||||
| from django_tables2 import Table | from django_tables2 import Table | ||||||
| from participation.models import Participation, Team, Video | from participation.models import Participation, Team, Video | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from datetime import timedelta | from datetime import timedelta | ||||||
| import os | import os | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from django.urls import path | from django.urls import path | ||||||
|  |  | ||||||
| from .views import MyAccountDetailView, ResetAdminView, SignupView, UserDetailView, UserImpersonateView, \ | from .views import MyAccountDetailView, ResetAdminView, SignupView, UserDetailView, UserImpersonateView, \ | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| import os | import os | ||||||
|  |  | ||||||
| from corres2math.tokens import email_validation_token | from corres2math.tokens import email_validation_token | ||||||
| @@ -210,7 +213,7 @@ class UserUpdateView(LoginRequiredMixin, UpdateView): | |||||||
|         context["title"] = _("Update user {user}").format(user=str(self.object.registration)) |         context["title"] = _("Update user {user}").format(user=str(self.object.registration)) | ||||||
|         context["registration_form"] = user.registration.form_class(data=self.request.POST or None, |         context["registration_form"] = user.registration.form_class(data=self.request.POST or None, | ||||||
|                                                                     instance=self.object.registration) |                                                                     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: |             if "team" in context["registration_form"].fields: | ||||||
|                 del context["registration_form"].fields["team"] |                 del context["registration_form"].fields["team"] | ||||||
|             del context["registration_form"].fields["email_confirmed"] |             del context["registration_form"].fields["email_confirmed"] | ||||||
| @@ -221,7 +224,7 @@ class UserUpdateView(LoginRequiredMixin, UpdateView): | |||||||
|         user = form.instance |         user = form.instance | ||||||
|         registration_form = user.registration.form_class(data=self.request.POST or None, |         registration_form = user.registration.form_class(data=self.request.POST or None, | ||||||
|                                                          instance=self.object.registration) |                                                          instance=self.object.registration) | ||||||
|         if not user.registration.is_admin: |         if not self.request.user.registration.is_admin: | ||||||
|             if "team" in registration_form.fields: |             if "team" in registration_form.fields: | ||||||
|                 del registration_form.fields["team"] |                 del registration_form.fields["team"] | ||||||
|             del registration_form.fields["email_confirmed"] |             del registration_form.fields["email_confirmed"] | ||||||
|   | |||||||
| @@ -0,0 +1,2 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| """ | """ | ||||||
| ASGI config for corres2math project. | ASGI config for corres2math project. | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| import os | import os | ||||||
|  |  | ||||||
| _client = None | _client = None | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from enum import Enum | from enum import Enum | ||||||
| import os | import os | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from threading import local | from threading import local | ||||||
|  |  | ||||||
| from django.conf import settings | from django.conf import settings | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| """ | """ | ||||||
| Django settings for corres2math project. | Django settings for corres2math project. | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| # Database | # Database | ||||||
| # https://docs.djangoproject.com/en/3.0/ref/settings/#databases | # https://docs.djangoproject.com/en/3.0/ref/settings/#databases | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| import os | import os | ||||||
|  |  | ||||||
| # Break it, fix it! | # Break it, fix it! | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| import os | import os | ||||||
|  |  | ||||||
| from django.core.handlers.asgi import ASGIHandler | from django.core.handlers.asgi import ASGIHandler | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| from django.contrib.auth.tokens import PasswordResetTokenGenerator | from django.contrib.auth.tokens import PasswordResetTokenGenerator | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| """corres2math URL Configuration | """corres2math URL Configuration | ||||||
|  |  | ||||||
| The `urlpatterns` list routes URLs to views. For more information please see: | The `urlpatterns` list routes URLs to views. For more information please see: | ||||||
|   | |||||||
| @@ -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.contrib.auth.mixins import LoginRequiredMixin | ||||||
| from django.core.exceptions import PermissionDenied | from django.core.exceptions import PermissionDenied | ||||||
| from haystack.generic_views import SearchView | from haystack.generic_views import SearchView | ||||||
|   | |||||||
| @@ -1,3 +1,6 @@ | |||||||
|  | # Copyright (C) 2020 by Animath | ||||||
|  | # SPDX-License-Identifier: GPL-3.0-or-later | ||||||
|  |  | ||||||
| """ | """ | ||||||
| WSGI config for corres2math project. | WSGI config for corres2math project. | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user