From b460e4abaa9f00617d62b551ba71fc1d6035083a Mon Sep 17 00:00:00 2001 From: xinwen Date: Tue, 2 Jun 2020 15:40:07 +0800 Subject: [PATCH] =?UTF-8?q?[Fix]=20=E6=97=A5=E5=BF=97=E5=AE=A1=E8=AE=A1=20?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E8=BF=87=E6=BB=A4=E4=B8=8E=E6=8E=92=E5=BA=8F?= =?UTF-8?q?bug=20(#4063)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/audits/api.py | 6 +++--- apps/audits/serializers.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/apps/audits/api.py b/apps/audits/api.py index 7deee860d..c7a0dd957 100644 --- a/apps/audits/api.py +++ b/apps/audits/api.py @@ -63,7 +63,7 @@ class OperateLogViewSet(ListModelMixin, OrgGenericViewSet): ] filterset_fields = ['user', 'action', 'resource_type'] search_fields = ['filename'] - ordering_fields = ['-datetime'] + ordering = ['-datetime'] class PasswordChangeLogViewSet(ListModelMixin, CommonGenericViewSet): @@ -75,7 +75,7 @@ class PasswordChangeLogViewSet(ListModelMixin, CommonGenericViewSet): ('datetime', ('date_from', 'date_to')) ] filterset_fields = ['user'] - ordering_fields = ['-datetime'] + ordering = ['-datetime'] def get_queryset(self): users = current_org.get_org_members() @@ -94,4 +94,4 @@ class CommandExecutionViewSet(ListModelMixin, OrgGenericViewSet): ('date_start', ('date_from', 'date_to')) ] search_fields = ['command'] - ordering_fields = ['-date_created'] + ordering = ['-date_created'] diff --git a/apps/audits/serializers.py b/apps/audits/serializers.py index a23efe534..192329e05 100644 --- a/apps/audits/serializers.py +++ b/apps/audits/serializers.py @@ -13,7 +13,7 @@ class FTPLogSerializer(serializers.ModelSerializer): class Meta: model = models.FTPLog fields = ( - 'user', 'remote_addr', 'asset', 'system_user', + 'id', 'user', 'remote_addr', 'asset', 'system_user', 'operate', 'filename', 'is_success', 'date_start' ) @@ -26,7 +26,7 @@ class UserLoginLogSerializer(serializers.ModelSerializer): class Meta: model = models.UserLoginLog fields = ( - 'username', 'type', 'type_display', 'ip', 'city', 'user_agent', + 'id', 'username', 'type', 'type_display', 'ip', 'city', 'user_agent', 'mfa', 'reason', 'status', 'status_display', 'datetime', 'mfa_display' ) @@ -35,7 +35,7 @@ class OperateLogSerializer(serializers.ModelSerializer): class Meta: model = models.OperateLog fields = ( - 'user', 'action', 'resource_type', 'resource', + 'id', 'user', 'action', 'resource_type', 'resource', 'remote_addr', 'datetime' ) @@ -44,7 +44,7 @@ class PasswordChangeLogSerializer(serializers.ModelSerializer): class Meta: model = models.PasswordChangeLog fields = ( - 'user', 'change_by', 'remote_addr', 'datetime' + 'id', 'user', 'change_by', 'remote_addr', 'datetime' ) @@ -58,7 +58,7 @@ class CommandExecutionSerializer(serializers.ModelSerializer): class Meta: model = CommandExecution fields = ( - 'hosts', 'run_as', 'command', 'user', 'is_finished', + 'id', 'hosts', 'run_as', 'command', 'user', 'is_finished', 'date_start', 'result', 'is_success' ) extra_kwargs = {