Add page titles

This commit is contained in:
Yohann D'ANELLO 2020-11-02 10:58:00 +01:00
parent c8029fdd7a
commit 4975d4ddb7
4 changed files with 80 additions and 31 deletions

View File

@ -152,6 +152,7 @@ class TeamDetailView(LoginRequiredMixin, FormMixin, ProcessFormView, DetailView)
context = super().get_context_data(**kwargs)
team = self.get_object()
context["title"] = _("Detail of team {trigram}").format(trigram=self.object.trigram)
context["request_validation_form"] = RequestValidationForm(self.request.POST or None)
context["validation_form"] = ValidateParticipationForm(self.request.POST or None)
# A team is complete when there are at least 3 members that have sent their photo authorization
@ -241,6 +242,7 @@ class TeamUpdateView(LoginRequiredMixin, UpdateView):
context = super().get_context_data(**kwargs)
context["participation_form"] = ParticipationForm(data=self.request.POST or None,
instance=self.object.participation)
context["title"] = _("Update team {trigram}").format(team=self.object.trigram)
return context
@transaction.atomic
@ -290,8 +292,8 @@ class TeamLeaveView(LoginRequiredMixin, TemplateView):
"""
A team member leaves a team
"""
template_name = "participation/team_leave.html"
extra_context = dict(title=_("Leave team"))
def dispatch(self, request, *args, **kwargs):
if not request.user.is_authenticated:
@ -389,6 +391,7 @@ class CreateQuestionView(LoginRequiredMixin, CreateView):
participation: Participation
model = Question
form_class = QuestionForm
extra_context = dict(title=_("Create question"))
def dispatch(self, request, *args, **kwargs):
if not request.user.is_authenticated:
@ -434,6 +437,7 @@ class DeleteQuestionView(LoginRequiredMixin, DeleteView):
Remove a question.
"""
model = Question
extra_context = dict(title=_("Delete question"))
def dispatch(self, request, *args, **kwargs):
self.object = self.get_object()
@ -456,6 +460,7 @@ class UploadVideoView(LoginRequiredMixin, UpdateView):
model = Video
form_class = UploadVideoForm
template_name = "participation/upload_video.html"
extra_context = dict(title=_("Upload video"))
def dispatch(self, request, *args, **kwargs):
user = request.user
@ -474,6 +479,7 @@ class CalendarView(SingleTableView):
"""
table_class = CalendarTable
model = Phase
extra_context = dict(title=_("Calendar"))
class PhaseUpdateView(AdminMixin, UpdateView):
@ -482,6 +488,7 @@ class PhaseUpdateView(AdminMixin, UpdateView):
"""
model = Phase
form_class = PhaseForm
extra_context = dict(title=_("Calendar update"))
def get_success_url(self):
return reverse_lazy("participation:calendar")

View File

@ -25,6 +25,7 @@ class SignupView(CreateView):
model = User
form_class = SignupForm
template_name = "registration/signup.html"
extra_context = dict(title=_("Sign up"))
def get_context_data(self, **kwargs):
context = super().get_context_data()
@ -62,7 +63,7 @@ class UserValidateView(TemplateView):
"""
title = _("Email validation")
template_name = 'registration/email_validation_complete.html'
extra_context = {"title": _("Validate email")}
extra_context = dict(title=_("Validate email"))
def get(self, *args, **kwargs):
"""
@ -112,7 +113,7 @@ class UserValidationEmailSentView(TemplateView):
Display the information that the validation link has been sent.
"""
template_name = 'registration/email_validation_email_sent.html'
extra_context = {"title": _('Email validation email sent')}
extra_context = dict(title=_('Email validation email sent'))
class UserResendValidationEmailView(LoginRequiredMixin, DetailView):
@ -120,7 +121,7 @@ class UserResendValidationEmailView(LoginRequiredMixin, DetailView):
Rensend the email validation link.
"""
model = User
extra_context = {"title": _("Resend email validation link")}
extra_context = dict(title=_("Resend email validation link"))
def get(self, request, *args, **kwargs):
user = self.get_object()
@ -152,6 +153,11 @@ class UserDetailView(LoginRequiredMixin, DetailView):
raise PermissionDenied
return super().dispatch(request, *args, **kwargs)
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["title"] = _("Detail of user {user}").format(user=str(self.object.registration))
return context
class UserUpdateView(LoginRequiredMixin, UpdateView):
"""
@ -170,6 +176,7 @@ class UserUpdateView(LoginRequiredMixin, UpdateView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
user = self.get_object()
context["title"] = _("Update user {user}").format(user=str(self.object.registration))
context["registration_form"] = user.registration.form_class(data=self.request.POST or None,
instance=self.object.registration)
return context
@ -196,6 +203,7 @@ class UserUploadPhotoAuthorizationView(LoginRequiredMixin, UpdateView):
model = StudentRegistration
form_class = PhotoAuthorizationForm
template_name = "registration/upload_photo_authorization.html"
extra_context = dict(title=_("Upload photo authorization"))
def dispatch(self, request, *args, **kwargs):
user = request.user

View File

@ -22,7 +22,7 @@ from registration.views import PhotoAuthorizationView
from .views import AdminSearchView
urlpatterns = [
path('', TemplateView.as_view(template_name="index.html"), name='index'),
path('', TemplateView.as_view(template_name="index.html", extra_context=dict(title="Accueil")), name='index'),
path('i18n/', include('django.conf.urls.i18n')),
path('admin/doc/', include('django.contrib.admindocs.urls')),
path('admin/', admin.site.urls, name="admin"),

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Corres2math\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-11-01 20:50+0100\n"
"POT-Creation-Date: 2020-11-02 10:56+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"
@ -328,7 +328,7 @@ msgstr "Solution proposée :"
#: apps/participation/templates/participation/participation_detail.html:27
#: apps/participation/templates/participation/participation_detail.html:154
#: apps/participation/templates/participation/participation_detail.html:182
#: apps/participation/templates/participation/participation_detail.html:235
#: apps/participation/templates/participation/participation_detail.html:234
#: 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
@ -461,7 +461,8 @@ msgid "Define team that receives your video"
msgstr "Définir l'équipe qui recevra votre vidéo"
#: apps/participation/templates/participation/participation_detail.html:181
#: apps/participation/templates/participation/participation_detail.html:234
#: apps/participation/templates/participation/participation_detail.html:233
#: apps/participation/views.py:463
msgid "Upload video"
msgstr "Envoyer la vidéo"
@ -472,8 +473,8 @@ msgstr "Afficher la solution"
#: apps/participation/templates/participation/participation_detail.html:187
#: apps/participation/templates/participation/participation_detail.html:194
#: apps/participation/templates/participation/participation_detail.html:230
#: apps/participation/templates/participation/participation_detail.html:241
#: apps/participation/templates/participation/participation_detail.html:229
#: apps/participation/templates/participation/participation_detail.html:240
msgid "This video platform is not supported yet."
msgstr "La plateforme de cette vidéo n'est pas encore supportée."
@ -496,16 +497,18 @@ msgid "Update question"
msgstr "Modifier la question"
#: apps/participation/templates/participation/participation_detail.html:217
#: apps/participation/views.py:440
msgid "Delete question"
msgstr "Supprimer la question"
#: apps/participation/templates/participation/participation_detail.html:229
#: apps/participation/templates/participation/participation_detail.html:240
#: apps/participation/templates/participation/participation_detail.html:228
#: apps/participation/templates/participation/participation_detail.html:239
msgid "Display synthesis"
msgstr "Afficher la synthèse"
#: apps/participation/templates/participation/phase_list.html:10
#: templates/base.html:68 templates/base.html:70 templates/base.html:217
#: apps/participation/views.py:482 templates/base.html:68
#: templates/base.html:70 templates/base.html:217
msgid "Calendar"
msgstr "Calendrier"
@ -617,6 +620,7 @@ msgid "Update team"
msgstr "Modifier l'équipe"
#: apps/participation/templates/participation/team_detail.html:127
#: apps/participation/views.py:296
msgid "Leave team"
msgstr "Quitter l'équipe"
@ -642,60 +646,78 @@ msgstr "Vous êtes déjà dans une équipe."
msgid "Join team"
msgstr "Rejoindre une équipe"
#: apps/participation/views.py:133 apps/participation/views.py:300
#: apps/participation/views.py:333
#: apps/participation/views.py:133 apps/participation/views.py:302
#: apps/participation/views.py:335
msgid "You are not in a team."
msgstr "Vous n'êtes pas dans une équipe."
#: apps/participation/views.py:134 apps/participation/views.py:334
#: apps/participation/views.py:134 apps/participation/views.py:336
msgid "You don't participate, so you don't have any team."
msgstr "Vous ne participez pas, vous n'avez donc pas d'équipe."
#: apps/participation/views.py:179
#: apps/participation/views.py:155
#, python-brace-format
msgid "Detail of team {trigram}"
msgstr "Détails de l'équipe {trigram}"
#: apps/participation/views.py:180
msgid "You don't participate, so you can't request the validation of the team."
msgstr ""
"Vous ne participez pas, vous ne pouvez pas demander la validation de "
"l'équipe."
#: apps/participation/views.py:182
#: apps/participation/views.py:183
msgid "The validation of the team is already done or pending."
msgstr "La validation de l'équipe est déjà faite ou en cours."
#: apps/participation/views.py:195
#: apps/participation/views.py:196
msgid "You are not an administrator."
msgstr "Vous n'êtes pas administrateur."
#: apps/participation/views.py:198
#: apps/participation/views.py:199
msgid "This team has no pending validation."
msgstr "L'équipe n'a pas de validation en attente."
#: apps/participation/views.py:217
#: apps/participation/views.py:218
msgid "You must specify if you validate the registration or not."
msgstr "Vous devez spécifier si vous validez l'inscription ou non."
#: apps/participation/views.py:280 apps/registration/views.py:235
#: apps/participation/views.py:245
#, python-brace-format
msgid "Update team {trigram}"
msgstr "Mise à jour de l'équipe {trigram}"
#: apps/participation/views.py:282 apps/registration/views.py:243
#, python-brace-format
msgid "Photo authorization of {student}.{ext}"
msgstr "Autorisation de droit à l'image de {student}.{ext}"
#: apps/participation/views.py:284
#: apps/participation/views.py:286
#, python-brace-format
msgid "Photo authorizations of team {trigram}.zip"
msgstr "Autorisations de droit à l'image de l'équipe {trigram}.zip"
#: apps/participation/views.py:302
#: apps/participation/views.py:304
msgid "The team is already validated or the validation is pending."
msgstr "La validation de l'équipe est déjà faite ou en cours."
#: apps/participation/views.py:346
#: apps/participation/views.py:348
msgid "The team is not validated yet."
msgstr "L'équipe n'est pas encore validée."
#: apps/participation/views.py:355
#: apps/participation/views.py:357
#, python-brace-format
msgid "Participation of team {trigram}"
msgstr "Participation de l'équipe {trigram}"
#: apps/participation/views.py:394
msgid "Create question"
msgstr "Créer une question"
#: apps/participation/views.py:491
msgid "Calendar update"
msgstr "Mise à jour du calendrier"
#: apps/registration/forms.py:18
msgid "role"
msgstr "rôle"
@ -941,6 +963,7 @@ msgstr "Réinitialiser mon mot de passe"
#: apps/registration/templates/registration/signup.html:5
#: apps/registration/templates/registration/signup.html:8
#: apps/registration/templates/registration/signup.html:20
#: apps/registration/views.py:28
msgid "Sign up"
msgstr "Inscription"
@ -1017,29 +1040,40 @@ msgid "Update user"
msgstr "Modifier l'utilisateur"
#: apps/registration/templates/registration/user_detail.html:77
#: apps/registration/views.py:206
msgid "Upload photo authorization"
msgstr "Téléverser l'autorisation de droit à l'image"
#: apps/registration/views.py:63
#: apps/registration/views.py:64
msgid "Email validation"
msgstr "Validation de l'adresse mail"
#: apps/registration/views.py:65
#: apps/registration/views.py:66
msgid "Validate email"
msgstr "Valider l'adresse mail"
#: apps/registration/views.py:104
#: apps/registration/views.py:105
msgid "Email validation unsuccessful"
msgstr "Échec de la validation de l'adresse mail"
#: apps/registration/views.py:115
#: apps/registration/views.py:116
msgid "Email validation email sent"
msgstr "Mail de confirmation de l'adresse mail envoyé"
#: apps/registration/views.py:123
#: apps/registration/views.py:124
msgid "Resend email validation link"
msgstr "Renvoyé le lien de validation de l'adresse mail"
#: apps/registration/views.py:158
#, python-brace-format
msgid "Detail of user {user}"
msgstr "Détails de l'utilisateur {user}"
#: apps/registration/views.py:179
#, python-brace-format
msgid "Update user {user}"
msgstr "Mise à jour de l'utilisateur {user}"
#: corres2math/settings.py:154
msgid "English"
msgstr "Anglais"