mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-25 07:02:22 +00:00
Better date render
This commit is contained in:
parent
4e29b4830a
commit
52f0d442cd
@ -198,6 +198,9 @@ class Tournament(models.Model):
|
|||||||
return Synthesis.objects.filter(final_solution=True)
|
return Synthesis.objects.filter(final_solution=True)
|
||||||
return Synthesis.objects.filter(participation__tournament=self)
|
return Synthesis.objects.filter(participation__tournament=self)
|
||||||
|
|
||||||
|
def get_absolute_url(self):
|
||||||
|
return reverse_lazy("participation:tournament_detail", args=(self.pk,))
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return repr(self)
|
return repr(self)
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# Copyright (C) 2020 by Animath
|
# Copyright (C) 2020 by Animath
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
from django.utils import formats
|
||||||
from django.utils.text import format_lazy
|
from django.utils.text import format_lazy
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
@ -57,8 +58,14 @@ class ParticipationTable(tables.Table):
|
|||||||
|
|
||||||
|
|
||||||
class TournamentTable(tables.Table):
|
class TournamentTable(tables.Table):
|
||||||
|
name = tables.LinkColumn()
|
||||||
|
|
||||||
|
date = tables.Column(_("date").capitalize, accessor="id")
|
||||||
|
|
||||||
def render_date(self, record):
|
def render_date(self, record):
|
||||||
return format_lazy(_("From {start} to {end}"), start=record.start, end=record.end)
|
return format_lazy(_("From {start} to {end}"),
|
||||||
|
start=formats.date_format(record.date_start, format="SHORT_DATE_FORMAT", use_l10n=True),
|
||||||
|
end=formats.date_format(record.date_end, format="SHORT_DATE_FORMAT", use_l10n=True))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
attrs = {
|
attrs = {
|
||||||
|
@ -74,9 +74,6 @@ class CreateTeamView(LoginRequiredMixin, CreateView):
|
|||||||
f"@{user.registration.matrix_username}:tfjm.org")
|
f"@{user.registration.matrix_username}:tfjm.org")
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def get_success_url(self):
|
|
||||||
return reverse_lazy("participation:team_detail", args=(self.object.pk,))
|
|
||||||
|
|
||||||
|
|
||||||
class JoinTeamView(LoginRequiredMixin, FormView):
|
class JoinTeamView(LoginRequiredMixin, FormView):
|
||||||
"""
|
"""
|
||||||
@ -294,9 +291,6 @@ class TeamUpdateView(LoginRequiredMixin, UpdateView):
|
|||||||
participation_form.save()
|
participation_form.save()
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|
||||||
def get_success_url(self):
|
|
||||||
return reverse_lazy("participation:team_detail", args=(self.object.pk,))
|
|
||||||
|
|
||||||
|
|
||||||
class TeamAuthorizationsView(LoginRequiredMixin, DetailView):
|
class TeamAuthorizationsView(LoginRequiredMixin, DetailView):
|
||||||
"""
|
"""
|
||||||
@ -430,9 +424,6 @@ class TournamentUpdateView(AdminMixin, UpdateView):
|
|||||||
model = Tournament
|
model = Tournament
|
||||||
form_class = TournamentForm
|
form_class = TournamentForm
|
||||||
|
|
||||||
def get_success_url(self):
|
|
||||||
return reverse_lazy("participation:tournament_detail", args=(self.object.pk,))
|
|
||||||
|
|
||||||
|
|
||||||
class TournamentDetailView(DetailView):
|
class TournamentDetailView(DetailView):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user