From 08805a63605ba2313ee9862bac6d90b0a6abf618 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Mon, 28 Apr 2025 22:44:08 +0200 Subject: [PATCH] Correction non-affichage des colonnes d'observation sans observateur --- participation/tables.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/participation/tables.py b/participation/tables.py index fd5f655..dad12d8 100644 --- a/participation/tables.py +++ b/participation/tables.py @@ -107,11 +107,6 @@ class PoolTable(tables.Table): class PassageTable(tables.Table): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - if not settings.HAS_OBSERVER: - del self.columns['observer'] - reporter = tables.LinkColumn( "participation:passage_detail", args=[tables.A("id")], @@ -135,16 +130,12 @@ class PassageTable(tables.Table): 'class': 'table table-condensed table-striped text-center', } model = Passage - fields = ('reporter', 'opponent', 'reviewer', 'observer', 'solution_number', ) + fields = ('reporter', 'opponent', 'reviewer',) \ + + (('observer',) if settings.HAS_OBSERVER else ()) \ + + ('solution_number', ) class NoteTable(tables.Table): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - if not settings.HAS_OBSERVER: - del self.columns['observer_writing'] - del self.columns['observer_oral'] - jury = tables.Column( attrs={ "td": { @@ -170,4 +161,6 @@ class NoteTable(tables.Table): } model = Note fields = ('jury', 'reporter_writing', 'reporter_oral', 'opponent_writing', 'opponent_oral', - 'reviewer_writing', 'reviewer_oral', 'observer_writing', 'observer_oral', 'update',) + 'reviewer_writing', 'reviewer_oral',) + \ + (('observer_writing', 'observer_oral') if settings.HAS_OBSERVER else ()) + \ + ('update',)