mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-02-06 12:13:01 +00:00
Request validation is working
This commit is contained in:
parent
691d3c1660
commit
acb718cdc0
@ -70,13 +70,16 @@
|
|||||||
<i class="fas fa-video"></i> {% trans "Access to team participation" %} <i class="fas fa-video"></i>
|
<i class="fas fa-video"></i> {% trans "Access to team participation" %} <i class="fas fa-video"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</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 user.registration.participates %}
|
||||||
{% if can_validate %}
|
{% if can_validate %}
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
{% trans "Your team has at least 3 members and all photo authorizations were given: the team can be validated." %}
|
{% trans "Your team has at least 3 members and all photo authorizations were given: the team can be validated." %}
|
||||||
<div class="text-center">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
|
||||||
|
from django.shortcuts import redirect
|
||||||
|
|
||||||
from corres2math.lists import get_sympa_client
|
from corres2math.lists import get_sympa_client
|
||||||
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
|
||||||
@ -96,6 +98,14 @@ class TeamDetailView(LoginRequiredMixin, DetailView):
|
|||||||
return super().get(request, *args, **kwargs)
|
return super().get(request, *args, **kwargs)
|
||||||
raise PermissionDenied
|
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):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ msgstr "L'équipe n'a pas encore demandé à être validée."
|
|||||||
|
|
||||||
#: apps/participation/templates/participation/team_detail.html:95
|
#: apps/participation/templates/participation/team_detail.html:95
|
||||||
msgid "Your validation is pending."
|
msgid "Your validation is pending."
|
||||||
msgstr ""
|
msgstr "Votre validation est en attente."
|
||||||
|
|
||||||
#: apps/participation/templates/participation/team_detail.html:103
|
#: apps/participation/templates/participation/team_detail.html:103
|
||||||
msgid "Update team"
|
msgid "Update team"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user