mirror of https://github.com/jumpserver/jumpserver
[Update] 修改settings和缩进
parent
829f57e2d7
commit
8014cc48b6
|
@ -234,7 +234,7 @@ LOGGING = {
|
|||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/1.10/topics/i18n/
|
||||
LANGUAGE_CODE = 'zh-cn'
|
||||
LANGUAGE_CODE = 'en'
|
||||
|
||||
TIME_ZONE = 'Asia/Shanghai'
|
||||
|
||||
|
|
|
@ -73,11 +73,11 @@ class CommandStore(CommandBase):
|
|||
session=session,
|
||||
)
|
||||
queryset = self.model.objects.filter(**filter_kwargs)
|
||||
return [command.to_dict() for command in queryset]
|
||||
return queryset
|
||||
|
||||
def count(self, date_from=None, date_to=None,
|
||||
user=None, asset=None, system_user=None,
|
||||
input=None, session=None):
|
||||
user=None, asset=None, system_user=None,
|
||||
input=None, session=None):
|
||||
filter_kwargs = self.make_filter_kwargs(
|
||||
date_from=date_from, date_to=date_to, user=user,
|
||||
asset=asset, system_user=system_user, input=input,
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
from jms_es_sdk import ESStore
|
||||
from .base import CommandBase
|
||||
from .models import AbstractSessionCommand
|
||||
|
||||
|
||||
class CommandStore(CommandBase, ESStore):
|
||||
|
@ -25,11 +26,13 @@ class CommandStore(CommandBase, ESStore):
|
|||
user=user, asset=asset, system_user=system_user,
|
||||
input=input, session=session
|
||||
)
|
||||
return [item["_source"] for item in data["hits"] if item]
|
||||
return AbstractSessionCommand.from_multi_dict(
|
||||
[item["_source"] for item in data["hits"] if item]
|
||||
)
|
||||
|
||||
def count(self, date_from=None, date_to=None,
|
||||
user=None, asset=None, system_user=None,
|
||||
input=None, session=None):
|
||||
user=None, asset=None, system_user=None,
|
||||
input=None, session=None):
|
||||
amount = ESStore.count(
|
||||
self, date_from=date_from, date_to=date_to,
|
||||
user=user, asset=asset, system_user=system_user,
|
||||
|
|
|
@ -10,9 +10,10 @@ class CommandStore(CommandBase):
|
|||
|
||||
def filter(self, **kwargs):
|
||||
queryset = []
|
||||
|
||||
for storage in self.storage_list:
|
||||
queryset.extend(storage.filter(**kwargs))
|
||||
return sorted(queryset, key=lambda command: command["timestamp"], reverse=True)
|
||||
return sorted(queryset, key=lambda command: command.timestamp, reverse=True)
|
||||
|
||||
def count(self, **kwargs):
|
||||
amount = 0
|
||||
|
|
Loading…
Reference in New Issue