add command log modal

This commit is contained in:
ibuler
2016-10-27 00:03:05 +08:00
parent 573b3a8743
commit d19b47a427
4 changed files with 46 additions and 12 deletions

View File

@@ -54,6 +54,17 @@ class ProxyLog(models.Model):
def __unicode__(self):
return '%s-%s-%s-%s' % (self.username, self.hostname, self.system_user, self.id)
@property
def commands_dict(self):
commands = self.command_log.all()
return [
{
"command_no": command.command_no,
"command": command.command,
"output": command.output_decode,
"datetime": command.datetime,
} for command in commands]
class Meta:
db_table = 'proxy_log'
ordering = ['-date_start', 'username']