1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2024-12-05 01:26:54 +00:00

Request validation is working

This commit is contained in:
Yohann D'ANELLO 2020-10-11 17:24:23 +02:00
parent 691d3c1660
commit acb718cdc0
3 changed files with 16 additions and 3 deletions

View File

@ -70,13 +70,16 @@
<i class="fas fa-video"></i> {% trans "Access to team participation" %} <i class="fas fa-video"></i>
</a>
</div>
{% elif team.participation.valid is None %} {# Team did not ask for validation #}
{% elif team.participation.valid == None %} {# Team did not ask for validation #}
{% if user.registration.participates %}
{% if can_validate %}
<div class="alert alert-info">
{% trans "Your team has at least 3 members and all photo authorizations were given: the team can be validated." %}
<div class="text-center">
<button class="btn btn-success">{% trans "Submit my team to validation" %}</button>
<form method="post">
{% csrf_token %}
<button class="btn btn-success" name="request-validation">{% trans "Submit my team to validation" %}</button>
</form>
</div>
</div>
{% else %}

View File

@ -1,6 +1,8 @@
from io import BytesIO
from zipfile import ZipFile
from django.shortcuts import redirect
from corres2math.lists import get_sympa_client
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import PermissionDenied
@ -96,6 +98,14 @@ class TeamDetailView(LoginRequiredMixin, DetailView):
return super().get(request, *args, **kwargs)
raise PermissionDenied
def post(self, request, *args, **kwargs):
if request.user.registration.participates:
if "request-validation" in request.POST:
request.user.registration.team.participation.valid = False
# TODO Send mail to admins
request.user.registration.team.participation.save()
return redirect(request.path)
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

View File

@ -340,7 +340,7 @@ msgstr "L'équipe n'a pas encore demandé à être validée."
#: apps/participation/templates/participation/team_detail.html:95
msgid "Your validation is pending."
msgstr ""
msgstr "Votre validation est en attente."
#: apps/participation/templates/participation/team_detail.html:103
msgid "Update team"