mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-21 07:58:26 +02:00
Drop a lot of Corres2math content
This commit is contained in:
@ -1,74 +0,0 @@
|
||||
# Generated by Django 3.1.3 on 2020-11-04 12:05
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import registration.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('participation', '0001_initial'),
|
||||
('contenttypes', '0002_remove_content_type_name'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Registration',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('give_contact_to_animath', models.BooleanField(default=False, verbose_name='Grant Animath to contact me in the future about other actions')),
|
||||
('email_confirmed', models.BooleanField(default=False, verbose_name='email confirmed')),
|
||||
('polymorphic_ctype', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_registration.registration_set+', to='contenttypes.contenttype')),
|
||||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='user')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'registration',
|
||||
'verbose_name_plural': 'registrations',
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='AdminRegistration',
|
||||
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')),
|
||||
('role', models.TextField(verbose_name='role of the administrator')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'admin registration',
|
||||
'verbose_name_plural': 'admin registrations',
|
||||
},
|
||||
bases=('registration.registration',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='StudentRegistration',
|
||||
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')),
|
||||
('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')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'student registration',
|
||||
'verbose_name_plural': 'student registrations',
|
||||
},
|
||||
bases=('registration.registration',),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='CoachRegistration',
|
||||
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')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'coach registration',
|
||||
'verbose_name_plural': 'coach registrations',
|
||||
},
|
||||
bases=('registration.registration',),
|
||||
),
|
||||
]
|
@ -129,11 +129,11 @@ class ParticipantRegistration(Registration):
|
||||
)
|
||||
|
||||
@property
|
||||
def type(self):
|
||||
def type(self): # pragma: no cover
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def form_class(self):
|
||||
def form_class(self): # pragma: no cover
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
from django import template
|
||||
from django_tables2 import Table
|
||||
from participation.models import Participation, Team, Video
|
||||
from participation.models import Participation, Team
|
||||
from participation.tables import ParticipationTable, TeamTable, VideoTable
|
||||
|
||||
from ..models import Registration
|
||||
@ -19,8 +19,6 @@ def search_table(results):
|
||||
table_class = TeamTable
|
||||
elif issubclass(model_class, Participation):
|
||||
table_class = ParticipationTable
|
||||
elif issubclass(model_class, Video):
|
||||
table_class = VideoTable
|
||||
return table_class([result.object for result in results], prefix=model_class._meta.model_name)
|
||||
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
# Copyright (C) 2020 by Animath
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from datetime import timedelta
|
||||
import os
|
||||
|
||||
from tfjm.tokens import email_validation_token
|
||||
@ -12,10 +11,9 @@ from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
from django.core.management import call_command
|
||||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.utils.encoding import force_bytes
|
||||
from django.utils.http import urlsafe_base64_encode
|
||||
from participation.models import Phase, Team
|
||||
from participation.models import Team
|
||||
|
||||
from .models import AdminRegistration, CoachRegistration, StudentRegistration
|
||||
|
||||
@ -54,8 +52,6 @@ class TestIndexPage(TestCase):
|
||||
response = self.client.get(reverse("participation:participation_detail", args=(1,)))
|
||||
self.assertRedirects(response, reverse("login") + "?next="
|
||||
+ reverse("participation:participation_detail", args=(1,)))
|
||||
response = self.client.get(reverse("participation:upload_video", args=(1,)))
|
||||
self.assertRedirects(response, reverse("login") + "?next=" + reverse("participation:upload_video", args=(1,)))
|
||||
|
||||
|
||||
class TestRegistration(TestCase):
|
||||
@ -110,13 +106,6 @@ class TestRegistration(TestCase):
|
||||
"""
|
||||
Ensure that the signup form is working successfully.
|
||||
"""
|
||||
# After first phase
|
||||
response = self.client.get(reverse("registration:signup"))
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
Phase.objects.filter(phase_number__gte=2).update(start=timezone.now() + timedelta(days=1),
|
||||
end=timezone.now() + timedelta(days=2))
|
||||
|
||||
response = self.client.get(reverse("registration:signup"))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
@ -300,7 +289,7 @@ class TestRegistration(TestCase):
|
||||
|
||||
response = self.client.post(reverse("registration:upload_user_photo_authorization",
|
||||
args=(self.student.registration.pk,)), data=dict(
|
||||
photo_authorization=open("tfjm/static/Autorisation de droit à l'image - majeur.pdf", "rb"),
|
||||
photo_authorization=open("tfjm/static/Fiche_sanitaire.pdf", "rb"),
|
||||
))
|
||||
self.assertRedirects(response, reverse("registration:user_detail", args=(self.student.pk,)), 302, 200)
|
||||
|
||||
@ -323,7 +312,7 @@ class TestRegistration(TestCase):
|
||||
old_authoratization = self.student.registration.photo_authorization.path
|
||||
response = self.client.post(reverse("registration:upload_user_photo_authorization",
|
||||
args=(self.student.registration.pk,)), data=dict(
|
||||
photo_authorization=open("tfjm/static/Autorisation de droit à l'image - majeur.pdf", "rb"),
|
||||
photo_authorization=open("tfjm/static/Fiche_sanitaire.pdf", "rb"),
|
||||
))
|
||||
self.assertRedirects(response, reverse("registration:user_detail", args=(self.student.pk,)), 302, 200)
|
||||
self.assertFalse(os.path.isfile(old_authoratization))
|
||||
|
@ -18,7 +18,6 @@ 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 Phase
|
||||
|
||||
from .forms import CoachRegistrationForm, PhotoAuthorizationForm, SignupForm, StudentRegistrationForm, UserForm
|
||||
from .models import Registration, StudentRegistration
|
||||
@ -34,15 +33,6 @@ class SignupView(CreateView):
|
||||
template_name = "registration/signup.html"
|
||||
extra_context = dict(title=_("Sign up"))
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
"""
|
||||
The signup view is available only during the first phase.
|
||||
"""
|
||||
current_phase = Phase.current_phase()
|
||||
if not current_phase or current_phase.phase_number >= 2:
|
||||
raise PermissionDenied(_("You can't register now."))
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data()
|
||||
|
||||
|
Reference in New Issue
Block a user