From 9a4a95a02db33e314cbc13fe76a99343954c128f Mon Sep 17 00:00:00 2001 From: --local Date: Mon, 1 Aug 2022 11:44:10 +0200 Subject: [PATCH] Hide "delete_run" column if non-shiftleader --- tables/tables.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tables/tables.py b/tables/tables.py index a3bea3f4..e603cd82 100644 --- a/tables/tables.py +++ b/tables/tables.py @@ -379,6 +379,14 @@ class ReferenceRunReconstructionTable(tables.Table): def render_apv_mode(self, record): return record.run.apv_mode + def before_render(self, request): + """ + Hook provided by django-tables especially for + conditionallly hiding columns + """ + if not request.user.has_shift_leader_rights: + self.columns.hide("delete_run") + class Meta: model = RunReconstruction fields = ()