diff --git a/apps/participation/templates/participation/join_team_modal.html b/apps/participation/templates/participation/join_team_modal.html
index 9b9deee..89aa7ca 100644
--- a/apps/participation/templates/participation/join_team_modal.html
+++ b/apps/participation/templates/participation/join_team_modal.html
@@ -1,4 +1,4 @@
-{% load crispy_forms_filters i18n %}
+{% load i18n %}
diff --git a/apps/participation/templates/participation/team_detail.html b/apps/participation/templates/participation/team_detail.html
index 0388bbd..e04d0dd 100644
--- a/apps/participation/templates/participation/team_detail.html
+++ b/apps/participation/templates/participation/team_detail.html
@@ -27,8 +27,25 @@
{{ team.students.all|join:", "|default:any }}
{% trans "Chosen problem:" %}
- {{ team.participation.problem|default:any }}
+ {{ team.participation.get_problem_display|default:any }}
+
+
+
+ {% include "participation/update_team_modal.html" %}
+{% endblock %}
+
+{% block extrajavascript %}
+
{% endblock %}
diff --git a/apps/participation/templates/participation/update_team.html b/apps/participation/templates/participation/update_team.html
new file mode 100644
index 0000000..28f0d28
--- /dev/null
+++ b/apps/participation/templates/participation/update_team.html
@@ -0,0 +1,15 @@
+{% extends "base.html" %}
+
+{% load crispy_forms_filters i18n %}
+
+{% block content %}
+
+{% endblock content %}
+
diff --git a/apps/participation/templates/participation/update_team_modal.html b/apps/participation/templates/participation/update_team_modal.html
new file mode 100644
index 0000000..82901f9
--- /dev/null
+++ b/apps/participation/templates/participation/update_team_modal.html
@@ -0,0 +1,21 @@
+{% load i18n %}
+
+
\ No newline at end of file
diff --git a/apps/participation/urls.py b/apps/participation/urls.py
index aa1b4da..7334b0f 100644
--- a/apps/participation/urls.py
+++ b/apps/participation/urls.py
@@ -1,6 +1,6 @@
from django.urls import path
-from .views import CreateTeamView, JoinTeamView, MyTeamDetailView, TeamDetailView
+from .views import CreateTeamView, JoinTeamView, MyTeamDetailView, TeamDetailView, TeamUpdateView
app_name = "participation"
@@ -10,4 +10,5 @@ urlpatterns = [
path("join_team/", JoinTeamView.as_view(), name="join_team"),
path("team/", MyTeamDetailView.as_view(), name="my_team_detail"),
path("team/
/", TeamDetailView.as_view(), name="team_detail"),
+ path("team//update/", TeamUpdateView.as_view(), name="update_team"),
]
diff --git a/apps/participation/views.py b/apps/participation/views.py
index 130fa32..ec24622 100644
--- a/apps/participation/views.py
+++ b/apps/participation/views.py
@@ -3,9 +3,9 @@ from django.core.exceptions import PermissionDenied
from django.db import transaction
from django.urls import reverse_lazy
from django.utils.translation import gettext_lazy as _
-from django.views.generic import CreateView, FormView, DetailView, RedirectView
+from django.views.generic import CreateView, FormView, DetailView, RedirectView, UpdateView
-from participation.forms import TeamForm, JoinTeamForm
+from participation.forms import TeamForm, JoinTeamForm, ParticipationForm
from participation.models import Team
@@ -74,3 +74,27 @@ class MyTeamDetailView(LoginRequiredMixin, RedirectView):
class TeamDetailView(LoginRequiredMixin, DetailView):
model = Team
+
+
+class TeamUpdateView(LoginRequiredMixin, UpdateView):
+ model = Team
+ form_class = TeamForm
+ template_name = "participation/update_team.html"
+
+ def get_context_data(self, **kwargs):
+ context = super().get_context_data(**kwargs)
+ context["participation_form"] = ParticipationForm(data=self.request.POST or None,
+ instance=self.object.participation)
+ return context
+
+ @transaction.atomic
+ def form_valid(self, form):
+ participation_form = ParticipationForm(data=self.request.POST or None, instance=self.object.participation)
+ if not participation_form.is_valid():
+ return self.form_invalid(form)
+
+ participation_form.save()
+ return super().form_valid(form)
+
+ def get_success_url(self):
+ return reverse_lazy("participation:team_detail", args=(self.object.pk,))
diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po
index 7bfee47..3fbf590 100644
--- a/locale/fr/LC_MESSAGES/django.po
+++ b/locale/fr/LC_MESSAGES/django.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Corres2math\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-09-24 09:53+0200\n"
+"POT-Creation-Date: 2020-09-24 11:08+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Yohann D'ANELLO \n"
"Language-Team: LANGUAGE \n"
@@ -32,6 +32,7 @@ msgstr "Cette tâche a échoué avec succès."
#: apps/eastereggs/templates/eastereggs/xp_modal.html:16
#: apps/participation/templates/participation/create_team_modal.html:16
#: apps/participation/templates/participation/join_team_modal.html:16
+#: apps/participation/templates/participation/update_team_modal.html:16
#: apps/registration/templates/registration/login_modal.html:16
msgid "Close"
msgstr "Fermer"
@@ -101,7 +102,7 @@ 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:14 apps/participation/models.py:18
+#: apps/participation/forms.py:14 apps/participation/models.py:20
msgid "The trigram must be composed of three uppercase letters."
msgstr "Le trigramme doit être composé de trois lettres majuscules."
@@ -109,27 +110,27 @@ msgstr "Le trigramme doit être composé de trois lettres majuscules."
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/models.py:11
+#: apps/participation/models.py:13
msgid "name"
msgstr "nom"
-#: apps/participation/models.py:17
+#: apps/participation/models.py:19
msgid "trigram"
msgstr "trigramme"
-#: apps/participation/models.py:25
+#: apps/participation/models.py:27
msgid "access code"
msgstr "code d'accès"
-#: apps/participation/models.py:26
+#: apps/participation/models.py:28
msgid "The access code let other people to join the team."
msgstr "Le code d'accès permet aux autres participants de rejoindre l'équipe."
-#: apps/participation/models.py:30
+#: apps/participation/models.py:32
msgid "Grant Animath to publish my video"
msgstr "Autoriser Animath à publier ma vidéo"
-#: apps/participation/models.py:31
+#: apps/participation/models.py:33
msgid ""
"Give the authorisation to publish the video on the main website to promote "
"the action."
@@ -137,80 +138,80 @@ msgstr ""
"Donner l'autorisation de publier la vidéo sur le site principal pour "
"promouvoir les Correspondances."
-#: apps/participation/models.py:41
+#: apps/participation/models.py:43
#, python-brace-format
msgid "Team {name} ({trigram})"
msgstr "Équipe {name} ({trigram})"
-#: apps/participation/models.py:44 apps/participation/models.py:55
+#: apps/participation/models.py:46 apps/participation/models.py:57
#: apps/registration/models.py:73 apps/registration/models.py:106
msgid "team"
msgstr "équipe"
-#: apps/participation/models.py:45
+#: apps/participation/models.py:47
msgid "teams"
msgstr "équipes"
-#: apps/participation/models.py:59
+#: apps/participation/models.py:61
#, python-brace-format
msgid "Problem #{problem:d}"
msgstr "Problème n°{problem:d}"
-#: apps/participation/models.py:62
+#: apps/participation/models.py:64
msgid "problem number"
msgstr "numéro de problème"
-#: apps/participation/models.py:71
+#: apps/participation/models.py:73
msgid "solution video"
msgstr "vidéo de solution"
-#: apps/participation/models.py:80
+#: apps/participation/models.py:82
msgid "received participation"
msgstr "participation reçue"
-#: apps/participation/models.py:89
+#: apps/participation/models.py:91
msgid "synthesis video"
msgstr "vidéo de synthèse"
-#: apps/participation/models.py:93
+#: apps/participation/models.py:95
#, python-brace-format
msgid "Participation of the team {name} ({trigram})"
msgstr "Participation de l'équipe {name} ({trigram})"
-#: apps/participation/models.py:96 apps/participation/models.py:104
+#: apps/participation/models.py:98 apps/participation/models.py:106
msgid "participation"
msgstr "participation"
-#: apps/participation/models.py:97
+#: apps/participation/models.py:99
msgid "participations"
msgstr "participations"
-#: apps/participation/models.py:108
+#: apps/participation/models.py:110
msgid "link"
msgstr "lien"
-#: apps/participation/models.py:109
+#: apps/participation/models.py:111
msgid "The full video link."
msgstr "Le lien complet de la vidéo."
-#: apps/participation/models.py:115
+#: apps/participation/models.py:117
msgid "valid"
msgstr "valide"
-#: apps/participation/models.py:116
+#: apps/participation/models.py:118
msgid "The video got the validation of the administrators."
msgstr "La vidéo a été validée par les administrateurs."
-#: apps/participation/models.py:120
+#: apps/participation/models.py:122
#, python-brace-format
msgid "Video of team {name} ({trigram})"
msgstr "Vidéo de l'équipe {name} ({trigram})"
-#: apps/participation/models.py:124
+#: apps/participation/models.py:126
msgid "video"
msgstr "vidéo"
-#: apps/participation/models.py:125
+#: apps/participation/models.py:127
msgid "videos"
msgstr "vidéos"
@@ -220,7 +221,7 @@ msgid "Create"
msgstr "Créer"
#: apps/participation/templates/participation/create_team_modal.html:8
-#: apps/participation/views.py:15 templates/base.html:76
+#: apps/participation/views.py:15 templates/base.html:70
msgid "Create team"
msgstr "Créer une équipe"
@@ -230,7 +231,7 @@ msgid "Join"
msgstr "Rejoindre"
#: apps/participation/templates/participation/join_team_modal.html:8
-#: apps/participation/views.py:41 templates/base.html:81
+#: apps/participation/views.py:41 templates/base.html:75
msgid "Join team"
msgstr "Rejoindre une équipe"
@@ -262,6 +263,16 @@ msgstr "Participants :"
msgid "Chosen problem:"
msgstr "Problème choisi :"
+#: apps/participation/templates/participation/team_detail.html:34
+#: apps/participation/templates/participation/update_team.html:12
+#: apps/participation/templates/participation/update_team_modal.html:15
+msgid "Update"
+msgstr "Modifier"
+
+#: apps/participation/templates/participation/update_team_modal.html:8
+msgid "Update team"
+msgstr "Modifier l'équipe"
+
#: apps/participation/views.py:23 apps/participation/views.py:49
msgid "You don't participate, so you can't create a team."
msgstr "Vous ne participez pas, vous ne pouvez pas créer d'équipe."
@@ -410,7 +421,7 @@ msgstr "Se reconnecter"
#: apps/registration/templates/registration/login_modal.html:8
#: apps/registration/templates/registration/login_modal.html:15
#: apps/registration/templates/registration/password_reset_complete.html:10
-#: templates/base.html:114 templates/registration/login.html:7
+#: templates/base.html:108 templates/registration/login.html:7
#: templates/registration/login.html:8 templates/registration/login.html:25
msgid "Log in"
msgstr "Connexion"
@@ -604,42 +615,38 @@ msgstr ""
"avec les détails de l'erreur. Vous pouvez désormais retourner voir des "
"vidéos."
-#: templates/base.html:70
+#: templates/base.html:64
msgid "Home"
msgstr "Accueil"
-#: templates/base.html:87
+#: templates/base.html:81
msgid "My team"
msgstr "Mon équipe"
-#: templates/base.html:94
+#: templates/base.html:88
msgid "Make a gift"
msgstr "Faire un don"
-#: templates/base.html:98
+#: templates/base.html:92
msgid "Administration"
msgstr "Administration"
-#: templates/base.html:105
+#: templates/base.html:99
msgid "Return to admin view"
msgstr "Retourner à l'interface administrateur"
-#: templates/base.html:110
+#: templates/base.html:104
msgid "Register"
msgstr "S'inscrire"
-#: templates/base.html:119
+#: templates/base.html:120
msgid "Log out"
msgstr "Déconnexion"
-#: templates/base.html:145
+#: templates/base.html:147
msgid "Contact us"
msgstr "Nous contacter"
-#: templates/base.html:168
-msgid "Back to top"
-msgstr "Retour en haut"
-
#: templates/registration/login.html:13
#, python-format
msgid ""
@@ -652,3 +659,6 @@ msgstr ""
#: templates/registration/login.html:23
msgid "Forgotten your password or username?"
msgstr "Mot de passe oublié ?"
+
+#~ msgid "Back to top"
+#~ msgstr "Retour en haut"