Finish command log

pull/530/head
ibuler 8 years ago
parent 961abad14b
commit bb9a067293

@ -6,7 +6,7 @@ from rest_framework import generics
import serializers
from .models import ProxyLog
from .models import ProxyLog, CommandLog
from .hands import IsSuperUserOrTerminalUser, Terminal
@ -45,5 +45,7 @@ class ProxyLogDetailApi(generics.RetrieveUpdateDestroyAPIView):
permission_classes = (IsSuperUserOrTerminalUser,)
class CommandLogCreateApi(generics.CreateAPIView):
class CommandLogCreateApi(generics.ListCreateAPIView):
queryset = CommandLog.objects.all()
serializer_class = serializers.CommandLogSerializer
permission_classes = (IsSuperUserOrTerminalUser,)

@ -60,14 +60,14 @@ class ProxyLog(models.Model):
class CommandLog(models.Model):
proxy_log = models.ForeignKey(ProxyLog, on_delete=models.CASCADE, related_name='command_log')
command_no = models.IntegerField()
command = models.CharField(max_length=1000, blank=True)
output = models.TextField(blank=True)
date_start = models.DateTimeField(null=True)
date_finished = models.DateTimeField(null=True)
datetime = models.DateTimeField(null=True)
def __unicode__(self):
return '%s: %s' % (self.id, self.command)
class Meta:
db_table = 'command_log'
ordering = ['-date_start', 'command']
ordering = ['command_no', 'command']

@ -16,5 +16,4 @@ class CommandLogSerializer(serializers.ModelSerializer):
model = models.CommandLog
if __name__ == '__main__':
pass

Loading…
Cancel
Save