1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 03:54:15 +00:00
webvirtcloud/logs/views.py

30 lines
No EOL
704 B
Python

from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from logs.models import Logs
def addlogmsg(userid, instanceid, message):
"""
:param request:
:return:
"""
add_log_msg = Logs(user_id=userid, instance_id=instanceid, message=message)
add_log_msg.save()
def showlogs(request):
"""
:param request:
:return:
"""
if not request.user.is_authenticated():
return HttpResponseRedirect(reverse('index'))
if not request.user.is_superuser:
return HttpResponseRedirect(reverse('index'))
logs = Logs.objects.all()
return render(request, 'showlogs.html', locals())