From ad6d2e1cd7c8e9b088cff01a836929d9b94fd236 Mon Sep 17 00:00:00 2001 From: Bai Date: Tue, 24 Sep 2024 11:49:11 +0800 Subject: [PATCH] fix: Fixed the issue that the workbench user login log only displays failed logs --- apps/audits/api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/audits/api.py b/apps/audits/api.py index cd1513c5c..f0504ad7a 100644 --- a/apps/audits/api.py +++ b/apps/audits/api.py @@ -146,7 +146,9 @@ class MyLoginLogViewSet(UserLoginCommonMixin, OrgReadonlyModelViewSet): def get_queryset(self): qs = super().get_queryset() - qs = qs.filter(username=self.request.user.username) + username = self.request.user.username + q = Q(username=username) | Q(username__icontains=f'({username})') + qs = qs.filter(q) return qs