From d940acb2263afa92785ba075eebbcba6862cf9e3 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Mon, 19 Oct 2020 15:49:53 +0200 Subject: [PATCH] Better video filtering --- apps/participation/tables.py | 8 +++++--- .../search/indexes/participation/participation_text.txt | 4 +++- .../templates/search/indexes/participation/video_text.txt | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/participation/tables.py b/apps/participation/tables.py index 5f3149e..dc34b04 100644 --- a/apps/participation/tables.py +++ b/apps/participation/tables.py @@ -54,17 +54,19 @@ class ParticipationTable(tables.Table): class VideoTable(tables.Table): - participation_name = tables.LinkColumn( + participationname = tables.LinkColumn( 'participation:participation_detail', args=[tables.A("participation__pk")], verbose_name=lambda: _("name").capitalize(), - accessor="participation__name", ) + def render_participationname(self, record): + return record.participation.team.name + class Meta: attrs = { 'class': 'table table condensed table-striped', } model = Team - fields = ('participation_name', 'link',) + fields = ('participationname', 'link',) template_name = 'django_tables2/bootstrap4.html' diff --git a/apps/participation/templates/search/indexes/participation/participation_text.txt b/apps/participation/templates/search/indexes/participation/participation_text.txt index 17f697d..57aa6bc 100644 --- a/apps/participation/templates/search/indexes/participation/participation_text.txt +++ b/apps/participation/templates/search/indexes/participation/participation_text.txt @@ -1,2 +1,4 @@ {{ object.team.name }} -{{ object.team.trigram }} \ No newline at end of file +{{ object.team.trigram }} +{{ object.problem }} +{{ object.get_problem_display }} diff --git a/apps/participation/templates/search/indexes/participation/video_text.txt b/apps/participation/templates/search/indexes/participation/video_text.txt index 0f1a368..4303f3a 100644 --- a/apps/participation/templates/search/indexes/participation/video_text.txt +++ b/apps/participation/templates/search/indexes/participation/video_text.txt @@ -1 +1,5 @@ {{ object.link }} +{{ object.participation.team.name }} +{{ object.participation.team.trigram }} +{{ object.participation.problem }} +{{ object.participation.get_problem_display }}