From b2c59f39ef6dc939b22394bfc427822171a99442 Mon Sep 17 00:00:00 2001 From: richard-dds Date: Mon, 24 Sep 2018 11:56:50 -0400 Subject: [PATCH] Only display "in workspace x" resource isn't a workspace --- atst/models/audit_event.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/atst/models/audit_event.py b/atst/models/audit_event.py index 3d6c9a00..d95da99c 100644 --- a/atst/models/audit_event.py +++ b/atst/models/audit_event.py @@ -24,12 +24,18 @@ class AuditEvent(Base, TimestampsMixin): def __str__(self): - user_str = "{} performed".format(self.user.full_name) if self.user else "ATAT System" + user_str = ( + "{} performed".format(self.user.full_name) if self.user else "ATAT System" + ) action_str = "{} on {} {}".format( self.action, self.resource_type, self.resource_id ) display_name_str = "({})".format(self.display_name) if self.display_name else "" - workspace_str = "in workspace {}".format(self.workspace_id) if self.workspace_id else "" + workspace_str = ( + "in workspace {}".format(self.workspace_id) + if self.workspace_id and self.resource_type != "workspace" + else "" + ) return " ".join([user_str, action_str, display_name_str, workspace_str])