mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-06-21 17:18:22 +02:00
Load result data in tables
This commit is contained in:
@ -6,6 +6,7 @@ class ParticipationConfig(AppConfig):
|
||||
name = 'participation'
|
||||
|
||||
def ready(self):
|
||||
from participation.signals import create_team_participation, update_mailing_list
|
||||
from participation.signals import create_team_participation, delete_related_videos, update_mailing_list
|
||||
pre_save.connect(update_mailing_list, "participation.Team")
|
||||
pre_delete.connect(delete_related_videos, "participation.Participation")
|
||||
post_save.connect(create_team_participation, "participation.Team")
|
||||
|
@ -22,4 +22,3 @@ class VideoIndex(indexes.ModelSearchIndex, indexes.Indexable):
|
||||
|
||||
class Meta:
|
||||
model = Video
|
||||
|
||||
|
70
apps/participation/tables.py
Normal file
70
apps/participation/tables.py
Normal file
@ -0,0 +1,70 @@
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
import django_tables2 as tables
|
||||
|
||||
from .models import Team
|
||||
|
||||
|
||||
# noinspection PyTypeChecker
|
||||
class TeamTable(tables.Table):
|
||||
name = tables.LinkColumn(
|
||||
'participation:team_detail',
|
||||
args=[tables.A("id")],
|
||||
verbose_name=lambda: _("name").capitalize(),
|
||||
)
|
||||
|
||||
problem = tables.Column(
|
||||
accessor="participation__problem",
|
||||
verbose_name=lambda: _("problem number").capitalize(),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
attrs = {
|
||||
'class': 'table table condensed table-striped',
|
||||
}
|
||||
model = Team
|
||||
fields = ('name', 'trigram', 'problem',)
|
||||
template_name = 'django_tables2/bootstrap4.html'
|
||||
|
||||
|
||||
# noinspection PyTypeChecker
|
||||
class ParticipationTable(tables.Table):
|
||||
name = tables.LinkColumn(
|
||||
'participation:participation_detail',
|
||||
args=[tables.A("id")],
|
||||
verbose_name=lambda: _("name").capitalize(),
|
||||
accessor="team__name",
|
||||
)
|
||||
|
||||
trigram = tables.Column(
|
||||
verbose_name=lambda: _("trigram").capitalize(),
|
||||
accessor="team__trigram",
|
||||
)
|
||||
|
||||
problem = tables.Column(
|
||||
verbose_name=lambda: _("problem number").capitalize(),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
attrs = {
|
||||
'class': 'table table condensed table-striped',
|
||||
}
|
||||
model = Team
|
||||
fields = ('name', 'trigram', 'problem',)
|
||||
template_name = 'django_tables2/bootstrap4.html'
|
||||
|
||||
|
||||
class VideoTable(tables.Table):
|
||||
participation_name = tables.LinkColumn(
|
||||
'participation:participation_detail',
|
||||
args=[tables.A("participation__pk")],
|
||||
verbose_name=lambda: _("name").capitalize(),
|
||||
accessor="participation__name",
|
||||
)
|
||||
|
||||
class Meta:
|
||||
attrs = {
|
||||
'class': 'table table condensed table-striped',
|
||||
}
|
||||
model = Team
|
||||
fields = ('participation_name', 'link',)
|
||||
template_name = 'django_tables2/bootstrap4.html'
|
@ -1,12 +1,11 @@
|
||||
import os
|
||||
from io import BytesIO
|
||||
import os
|
||||
from zipfile import ZipFile
|
||||
|
||||
from django.core.mail import send_mail
|
||||
|
||||
from corres2math.lists import get_sympa_client
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.core.mail import send_mail
|
||||
from django.db import transaction
|
||||
from django.http import HttpResponse
|
||||
from django.template.loader import render_to_string
|
||||
|
Reference in New Issue
Block a user