mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2024-12-05 02:06:52 +00:00
Define the team which receives our video
This commit is contained in:
parent
e9c56104df
commit
95e1c4f821
@ -115,6 +115,35 @@ class ReceiveParticipationForm(forms.ModelForm):
|
||||
fields = ('received_participation',)
|
||||
|
||||
|
||||
class SendParticipationForm(forms.ModelForm):
|
||||
"""
|
||||
Update the sent participation of a participation.
|
||||
"""
|
||||
sent_participation = forms.ModelChoiceField(
|
||||
queryset=Participation.objects,
|
||||
label=lambda: _("Send to team"),
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields["sent_participation"].initial = self.instance.sent_participation
|
||||
self.fields["sent_participation"].queryset = Participation.objects.filter(
|
||||
~Q(pk=self.instance.pk) & Q(problem=self.instance.problem, valid=True)
|
||||
)
|
||||
|
||||
def clean(self, commit=True):
|
||||
cleaned_data = super().clean()
|
||||
participation = cleaned_data["sent_participation"]
|
||||
participation.received_participation = self.instance
|
||||
self.instance = participation
|
||||
return cleaned_data
|
||||
|
||||
|
||||
class Meta:
|
||||
model = Participation
|
||||
fields = ('sent_participation',)
|
||||
|
||||
|
||||
class PhaseForm(forms.ModelForm):
|
||||
"""
|
||||
Form to update the calendar of a phase.
|
||||
|
@ -50,7 +50,7 @@
|
||||
<dd class="col-md-5">{{ participation.sent_participation.team|default:any }}</dd>
|
||||
{% if user.registration.is_admin %}
|
||||
<dd class="col-xs-2">
|
||||
<button class="btn btn-primary">{% trans "Change" %}</button>
|
||||
<button class="btn btn-primary" data-toggle="modal" data-target="#defineSentParticipationModal">{% trans "Change" %}</button>
|
||||
</dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
@ -125,6 +125,11 @@
|
||||
{% trans "Update" as modal_button %}
|
||||
{% url "participation:participation_receive_participation" pk=participation.pk as modal_action %}
|
||||
{% include "base_modal.html" with modal_id="defineReceivedParticipation" %}
|
||||
|
||||
{% trans "Define team that receives your video" as modal_title %}
|
||||
{% trans "Update" as modal_button %}
|
||||
{% url "participation:participation_send_participation" pk=participation.pk as modal_action %}
|
||||
{% include "base_modal.html" with modal_id="defineSentParticipation" %}
|
||||
{% endif %}
|
||||
|
||||
{% trans "Upload video" as modal_title %}
|
||||
@ -145,6 +150,11 @@
|
||||
if (!modalBody.html().trim())
|
||||
modalBody.load("{% url "participation:participation_receive_participation" pk=participation.pk %} #form-content");
|
||||
});
|
||||
$('button[data-target="#defineSentParticipationModal"]').click(function() {
|
||||
let modalBody = $("#defineSentParticipationModal div.modal-body");
|
||||
if (!modalBody.html().trim())
|
||||
modalBody.load("{% url "participation:participation_send_participation" pk=participation.pk %} #form-content");
|
||||
});
|
||||
{% endif %}
|
||||
$('button[data-target="#uploadSolutionModal"]').click(function() {
|
||||
let modalBody = $("#uploadSolutionModal div.modal-body");
|
||||
|
@ -0,0 +1,14 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% load crispy_forms_filters i18n %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post">
|
||||
<div id="form-content">
|
||||
{% csrf_token %}
|
||||
{{ form|crispy }}
|
||||
</div>
|
||||
<button class="btn btn-primary" type="submit">{% trans "Update" %}</button>
|
||||
</form>
|
||||
{% endblock content %}
|
||||
|
@ -2,8 +2,9 @@ from django.urls import path
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from .views import CalendarView, CreateTeamView, JoinTeamView, MyParticipationDetailView, MyTeamDetailView, \
|
||||
ParticipationDetailView, PhaseUpdateView, SetParticipationReceiveParticipationView, TeamAuthorizationsView, \
|
||||
TeamDetailView, TeamLeaveView, TeamUpdateView, UploadVideoView
|
||||
ParticipationDetailView, PhaseUpdateView, SetParticipationReceiveParticipationView, \
|
||||
SetParticipationSendParticipationView, TeamAuthorizationsView, TeamDetailView, TeamLeaveView, TeamUpdateView, \
|
||||
UploadVideoView
|
||||
|
||||
|
||||
app_name = "participation"
|
||||
@ -21,6 +22,8 @@ urlpatterns = [
|
||||
path("detail/upload-video/<int:pk>/", UploadVideoView.as_view(), name="upload_video"),
|
||||
path("detail/<int:pk>/receive-participation/", SetParticipationReceiveParticipationView.as_view(),
|
||||
name="participation_receive_participation"),
|
||||
path("detail/<int:pk>/send-participation/", SetParticipationSendParticipationView.as_view(),
|
||||
name="participation_send_participation"),
|
||||
path("calendar/", CalendarView.as_view(), name="calendar"),
|
||||
path("calendar/<int:pk>/", PhaseUpdateView.as_view(), name="update_phase"),
|
||||
path("chat/", TemplateView.as_view(template_name="participation/chat.html"), name="chat")
|
||||
|
@ -20,8 +20,8 @@ from django_tables2 import SingleTableView
|
||||
from magic import Magic
|
||||
from registration.models import AdminRegistration
|
||||
|
||||
from .forms import JoinTeamForm, ParticipationForm, PhaseForm, ReceiveParticipationForm, RequestValidationForm,\
|
||||
TeamForm, UploadVideoForm, ValidateParticipationForm
|
||||
from .forms import JoinTeamForm, ParticipationForm, PhaseForm, ReceiveParticipationForm, RequestValidationForm, \
|
||||
SendParticipationForm, TeamForm, UploadVideoForm, ValidateParticipationForm
|
||||
from .models import Participation, Phase, Team, Video
|
||||
from .tables import CalendarTable
|
||||
|
||||
@ -370,6 +370,18 @@ class SetParticipationReceiveParticipationView(AdminMixin, UpdateView):
|
||||
return reverse_lazy("participation:participation_detail", args=(self.object.pk,))
|
||||
|
||||
|
||||
class SetParticipationSendParticipationView(AdminMixin, UpdateView):
|
||||
"""
|
||||
Define the team where the solution will be sent.
|
||||
"""
|
||||
model = Participation
|
||||
form_class = SendParticipationForm
|
||||
template_name = "participation/send_participation_form.html"
|
||||
|
||||
def get_success_url(self):
|
||||
return reverse_lazy("participation:participation_detail", args=(self.object.pk,))
|
||||
|
||||
|
||||
class UploadVideoView(LoginRequiredMixin, UpdateView):
|
||||
"""
|
||||
Upload a solution video for a team.
|
||||
|
@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Corres2math\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-10-31 12:36+0100\n"
|
||||
"POT-Creation-Date: 2020-10-31 13:32+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: Yohann D'ANELLO <yohann.danello@animath.fr>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@ -99,35 +99,39 @@ msgstr "changelogs"
|
||||
msgid "Changelog of type \"{action}\" for model {model} at {timestamp}"
|
||||
msgstr "Changelog de type \"{action}\" pour le modèle {model} le {timestamp}"
|
||||
|
||||
#: apps/participation/forms.py:19 apps/participation/models.py:33
|
||||
#: apps/participation/forms.py:20 apps/participation/models.py:33
|
||||
msgid "The trigram must be composed of three uppercase letters."
|
||||
msgstr "Le trigramme doit être composé de trois lettres majuscules."
|
||||
|
||||
#: apps/participation/forms.py:34
|
||||
#: apps/participation/forms.py:35
|
||||
msgid "No team was found with this access code."
|
||||
msgstr "Aucune équipe n'a été trouvée avec ce code d'accès."
|
||||
|
||||
#: apps/participation/forms.py:68
|
||||
#: apps/participation/forms.py:69
|
||||
msgid "I engage myself to participate to the whole \"Correspondances\"."
|
||||
msgstr "Je m'engage à participer à l'intégralité des Correspondances."
|
||||
|
||||
#: apps/participation/forms.py:83
|
||||
#: apps/participation/forms.py:84
|
||||
msgid "Message to address to the team:"
|
||||
msgstr "Message à adresser à l'équipe :"
|
||||
|
||||
#: apps/participation/forms.py:98
|
||||
#: apps/participation/forms.py:99
|
||||
msgid "You can't upload your video after the deadline."
|
||||
msgstr "Vous ne pouvez pas envoyer de vidéo après la date limite."
|
||||
|
||||
#: apps/participation/forms.py:127
|
||||
#: apps/participation/forms.py:124
|
||||
msgid "Send to team"
|
||||
msgstr "Envoyer à l'équipe"
|
||||
|
||||
#: apps/participation/forms.py:162
|
||||
msgid "Start date must be before the end date."
|
||||
msgstr "La date de début doit être avant la date de fin."
|
||||
|
||||
#: apps/participation/forms.py:129
|
||||
#: apps/participation/forms.py:164
|
||||
msgid "This phase must start after the previous phases."
|
||||
msgstr "Cette phase doit commencer après les phases précédentes."
|
||||
|
||||
#: apps/participation/forms.py:131
|
||||
#: apps/participation/forms.py:166
|
||||
msgid "This phase must end after the next phases."
|
||||
msgstr "Cette phase doit finir avant les phases suivantes."
|
||||
|
||||
@ -312,7 +316,7 @@ msgid "Proposed solution:"
|
||||
msgstr "Solution proposée :"
|
||||
|
||||
#: apps/participation/templates/participation/participation_detail.html:27
|
||||
#: apps/participation/templates/participation/participation_detail.html:131
|
||||
#: apps/participation/templates/participation/participation_detail.html:136
|
||||
#: apps/participation/templates/participation/upload_video.html:11
|
||||
#: apps/registration/templates/registration/upload_photo_authorization.html:18
|
||||
#: apps/registration/templates/registration/user_detail.html:78
|
||||
@ -397,9 +401,11 @@ msgid "Define received video"
|
||||
msgstr "Définir la vidéo reçue"
|
||||
|
||||
#: apps/participation/templates/participation/participation_detail.html:125
|
||||
#: apps/participation/templates/participation/participation_detail.html:130
|
||||
#: apps/participation/templates/participation/phase_form.html:11
|
||||
#: apps/participation/templates/participation/phase_list.html:18
|
||||
#: apps/participation/templates/participation/receive_participation_form.html:11
|
||||
#: apps/participation/templates/participation/send_participation_form.html:11
|
||||
#: apps/participation/templates/participation/team_detail.html:64
|
||||
#: apps/participation/templates/participation/team_detail.html:123
|
||||
#: apps/participation/templates/participation/update_team.html:12
|
||||
@ -409,15 +415,19 @@ msgstr "Définir la vidéo reçue"
|
||||
msgid "Update"
|
||||
msgstr "Modifier"
|
||||
|
||||
#: apps/participation/templates/participation/participation_detail.html:130
|
||||
#: apps/participation/templates/participation/participation_detail.html:129
|
||||
msgid "Define team that receives your video"
|
||||
msgstr "Définir l'équipe qui recevra votre vidéo"
|
||||
|
||||
#: apps/participation/templates/participation/participation_detail.html:135
|
||||
msgid "Upload video"
|
||||
msgstr "Envoyer la vidéo"
|
||||
|
||||
#: apps/participation/templates/participation/participation_detail.html:134
|
||||
#: apps/participation/templates/participation/participation_detail.html:139
|
||||
msgid "Display solution"
|
||||
msgstr "Afficher la solution"
|
||||
|
||||
#: apps/participation/templates/participation/participation_detail.html:135
|
||||
#: apps/participation/templates/participation/participation_detail.html:140
|
||||
msgid "This video platform is not supported yet."
|
||||
msgstr "La plateforme de cette vidéo n'est pas encore supportée."
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user