2017-12-04 08:41:00 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
#
|
|
|
|
|
2019-07-03 14:28:20 +00:00
|
|
|
from django.views.generic import TemplateView
|
2017-12-04 08:41:00 +00:00
|
|
|
from django.utils.translation import ugettext as _
|
2019-07-03 08:29:39 +00:00
|
|
|
from django.utils import timezone
|
2017-12-04 08:41:00 +00:00
|
|
|
|
2019-09-12 10:56:26 +00:00
|
|
|
from common.permissions import PermissionsMixin, IsOrgAdmin, IsOrgAuditor
|
2017-12-04 08:41:00 +00:00
|
|
|
|
2019-07-03 10:03:01 +00:00
|
|
|
__all__ = ['CommandListView']
|
2017-12-04 08:41:00 +00:00
|
|
|
|
|
|
|
|
2019-07-03 14:28:20 +00:00
|
|
|
class CommandListView(PermissionsMixin, TemplateView):
|
2017-12-04 08:41:00 +00:00
|
|
|
template_name = "terminal/command_list.html"
|
2019-09-12 10:56:26 +00:00
|
|
|
permission_classes = [IsOrgAdmin | IsOrgAuditor]
|
2019-07-03 08:29:39 +00:00
|
|
|
default_days_ago = 5
|
2017-12-04 08:41:00 +00:00
|
|
|
|
|
|
|
def get_context_data(self, **kwargs):
|
2019-07-03 08:29:39 +00:00
|
|
|
now = timezone.now()
|
2017-12-04 08:41:00 +00:00
|
|
|
context = {
|
2019-06-20 10:10:44 +00:00
|
|
|
'app': _('Sessions'),
|
2017-12-04 08:41:00 +00:00
|
|
|
'action': _('Command list'),
|
2019-07-03 08:29:39 +00:00
|
|
|
'date_from': now - timezone.timedelta(days=self.default_days_ago),
|
|
|
|
'date_to': now,
|
2017-12-04 08:41:00 +00:00
|
|
|
}
|
|
|
|
kwargs.update(context)
|
|
|
|
return super().get_context_data(**kwargs)
|
|
|
|
|