Skip to content

Commit

Permalink
Merge pull request #190 from CMSTrackerDPG/#189
Browse files Browse the repository at this point in the history
Hide "Delete" column in Reference runs if not a shiftleader [Closes #189]
  • Loading branch information
nothingface0 authored Aug 1, 2022
2 parents cb0a5cc + 9a4a95a commit f6f3a4c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tables/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ()
Expand Down

0 comments on commit f6f3a4c

Please sign in to comment.