Commit 42e4c64d authored by ibuler's avatar ibuler

[Bugfix] 修复一些bug

parent 9c7bd7d2
......@@ -12,6 +12,3 @@ class RecordBase(object):
@abc.abstractmethod
def filter(self, date_from_ts=None, proxy_log_id=None):
pass
......@@ -58,6 +58,10 @@ class ProxyLog(models.Model):
def __unicode__(self):
return '%s-%s-%s' % (self.user, self.asset, self.system_user)
def commands(self):
from audits.backends import command_store
return command_store.filter(proxy_log_id=self.id)
class Meta:
ordering = ['-date_start', 'user']
......
......@@ -98,7 +98,7 @@
</td>
{% else %}
<td class="text-center">
<i class="fa fa-times text-danger"></i>
<a><i class="fa fa-times text-danger"></i></a>
</td>
<td class="text-center">
<a><span class="text-danger"><i class="fa fa-eye"></i></span></a>
......
......@@ -4,11 +4,15 @@ from .. import views
app_name = 'audits'
urlpatterns = [
url(r'^proxy-log$', views.ProxyLogListView.as_view(), name='proxy-log-list'),
url(r'^proxy-log/(?P<pk>\d+)$', views.ProxyLogDetailView.as_view(), name='proxy-log-detail'),
url(r'^proxy-log/(?P<pk>\d+)/commands$', views.ProxyLogCommandsListView.as_view(), name='proxy-log-commands-list'),
url(r'^command-log$', views.CommandLogListView.as_view(), name='command-log-list'),
url(r'^login-log$', views.LoginLogListView.as_view(), name='login-log-list'),
url(r'^proxy-log$', views.ProxyLogListView.as_view(),
name='proxy-log-list'),
url(r'^proxy-log/(?P<pk>\d+)$', views.ProxyLogDetailView.as_view(),
name='proxy-log-detail'),
# url(r'^proxy-log/(?P<pk>\d+)/commands$', views.ProxyLogCommandsListView.as_view(), name='proxy-log-commands-list'),
url(r'^command-log$', views.CommandLogListView.as_view(),
name='command-log-list'),
url(r'^login-log$', views.LoginLogListView.as_view(),
name='login-log-list'),
]
......@@ -110,19 +110,19 @@ class ProxyLogDetailView(AdminUserRequiredMixin,
return super(ProxyLogDetailView, self).get_context_data(**kwargs)
class ProxyLogCommandsListView(AdminUserRequiredMixin,
SingleObjectMixin,
ListView):
template_name = 'audits/proxy_log_commands_list_modal.html'
object = ''
def get(self, request, *args, **kwargs):
self.object = self.get_object(queryset=ProxyLog.objects.all())
return super(ProxyLogCommandsListView, self).\
get(request, *args, **kwargs)
def get_queryset(self):
return list(self.object.command_log.all())
# class ProxyLogCommandsListView(AdminUserRequiredMixin,
# SingleObjectMixin,
# ListView):
# template_name = 'audits/proxy_log_commands_list_modal.html'
# object = ''
#
# def get(self, request, *args, **kwargs):
# self.object = self.get_object(queryset=ProxyLog.objects.all())
# return super(ProxyLogCommandsListView, self).\
# get(request, *args, **kwargs)
#
# def get_queryset(self):
# return list(self.object.command_log.all())
class CommandLogListView(AdminUserRequiredMixin, ListView):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment