mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 14:32:19 +01:00 
			
		
		
		
	Better date render
This commit is contained in:
		@@ -198,6 +198,9 @@ class Tournament(models.Model):
 | 
			
		||||
            return Synthesis.objects.filter(final_solution=True)
 | 
			
		||||
        return Synthesis.objects.filter(participation__tournament=self)
 | 
			
		||||
 | 
			
		||||
    def get_absolute_url(self):
 | 
			
		||||
        return reverse_lazy("participation:tournament_detail", args=(self.pk,))
 | 
			
		||||
 | 
			
		||||
    def __str__(self):
 | 
			
		||||
        return repr(self)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
# Copyright (C) 2020 by Animath
 | 
			
		||||
# SPDX-License-Identifier: GPL-3.0-or-later
 | 
			
		||||
from django.utils import formats
 | 
			
		||||
from django.utils.text import format_lazy
 | 
			
		||||
from django.utils.translation import gettext_lazy as _
 | 
			
		||||
import django_tables2 as tables
 | 
			
		||||
@@ -57,8 +58,14 @@ class ParticipationTable(tables.Table):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TournamentTable(tables.Table):
 | 
			
		||||
    name = tables.LinkColumn()
 | 
			
		||||
 | 
			
		||||
    date = tables.Column(_("date").capitalize, accessor="id")
 | 
			
		||||
 | 
			
		||||
    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:
 | 
			
		||||
        attrs = {
 | 
			
		||||
 
 | 
			
		||||
@@ -74,9 +74,6 @@ class CreateTeamView(LoginRequiredMixin, CreateView):
 | 
			
		||||
                      f"@{user.registration.matrix_username}:tfjm.org")
 | 
			
		||||
        return ret
 | 
			
		||||
 | 
			
		||||
    def get_success_url(self):
 | 
			
		||||
        return reverse_lazy("participation:team_detail", args=(self.object.pk,))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class JoinTeamView(LoginRequiredMixin, FormView):
 | 
			
		||||
    """
 | 
			
		||||
@@ -294,9 +291,6 @@ class TeamUpdateView(LoginRequiredMixin, UpdateView):
 | 
			
		||||
        participation_form.save()
 | 
			
		||||
        return super().form_valid(form)
 | 
			
		||||
 | 
			
		||||
    def get_success_url(self):
 | 
			
		||||
        return reverse_lazy("participation:team_detail", args=(self.object.pk,))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TeamAuthorizationsView(LoginRequiredMixin, DetailView):
 | 
			
		||||
    """
 | 
			
		||||
@@ -430,9 +424,6 @@ class TournamentUpdateView(AdminMixin, UpdateView):
 | 
			
		||||
    model = Tournament
 | 
			
		||||
    form_class = TournamentForm
 | 
			
		||||
 | 
			
		||||
    def get_success_url(self):
 | 
			
		||||
        return reverse_lazy("participation:tournament_detail", args=(self.object.pk,))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TournamentDetailView(DetailView):
 | 
			
		||||
    """
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user