2015-03-03 09:34:09 +00:00
|
|
|
from django.shortcuts import render
|
|
|
|
from django.http import HttpResponseRedirect
|
|
|
|
from django.core.urlresolvers import reverse
|
|
|
|
from logs.models import Logs
|
|
|
|
|
|
|
|
|
2015-03-18 13:48:29 +00:00
|
|
|
def addlogmsg(userid, instanceid, message):
|
|
|
|
"""
|
|
|
|
:param request:
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
add_log_msg = Logs(user_id=userid, instance_id=instanceid, message=message)
|
|
|
|
add_log_msg.save()
|
|
|
|
|
|
|
|
|
2015-03-03 09:34:09 +00:00
|
|
|
def showlogs(request):
|
2015-03-16 13:46:44 +00:00
|
|
|
"""
|
|
|
|
:param request:
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
|
|
|
|
if not request.user.is_authenticated():
|
|
|
|
return HttpResponseRedirect(reverse('index'))
|
|
|
|
|
|
|
|
if not request.user.is_superuser:
|
|
|
|
return HttpResponseRedirect(reverse('index'))
|
|
|
|
|
2015-03-16 14:51:51 +00:00
|
|
|
logs = Logs.objects.all()
|
2015-03-16 13:46:44 +00:00
|
|
|
|
2015-04-02 13:20:46 +00:00
|
|
|
return render(request, 'showlogs.html', locals())
|