1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-04 19:04:03 +02:00

Add calendar view

This commit is contained in:
Yohann D'ANELLO
2020-10-20 13:06:51 +02:00
parent d1f2402373
commit 168bfc83c9
6 changed files with 84 additions and 41 deletions

View File

@ -1,7 +1,23 @@
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
import django_tables2 as tables
from .models import Team
from .models import Phase, Team
class CalendarTable(tables.Table):
class Meta:
attrs = {
'class': 'table table condensed table-striped',
}
row_attrs = {
'class': lambda record: 'bg-success' if timezone.now() > record.end else
'bg-waring' if timezone.now() > record.start else
'bg-danger'
}
model = Phase
fields = ('phase_number', 'description', 'start', 'end',)
template_name = 'django_tables2/bootstrap4.html'
# noinspection PyTypeChecker