From f207781027027aa89335c87de2d96dba0ca5c72b Mon Sep 17 00:00:00 2001 From: Julian Leucker <leuckerj@gmail.com> Date: Sun, 16 May 2021 15:17:27 +0200 Subject: [PATCH] Simplify if-condition in tables.py --- aleksis/apps/alsijil/tables.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/aleksis/apps/alsijil/tables.py b/aleksis/apps/alsijil/tables.py index 22a6b21ca..467fc7f5c 100644 --- a/aleksis/apps/alsijil/tables.py +++ b/aleksis/apps/alsijil/tables.py @@ -133,14 +133,13 @@ class PersonalNoteTable(tables.Table): ) def render_excused(self, value, record): - if record.absent: - if value: - context = dict(content=_("Excused"), classes="green white-text") + if record.absent and value: + context = dict(content=_("Excused"), classes="green white-text") + badge = render_to_string("components/materialize-chips.html", context) + if record.excuse_type: + context = dict(content=record.excuse_type.name, classes="green white-text") badge = render_to_string("components/materialize-chips.html", context) - if record.excuse_type: - context = dict(content=record.excuse_type.name, classes="green white-text") - badge = render_to_string("components/materialize-chips.html", context) - return badge + return badge return "–" def render_late(self, value): -- GitLab