mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-07-06 05:23:53 +02:00
Add page titles
This commit is contained in:
@ -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")
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user