Add logs and block for templates

This commit is contained in:
Retspen
2015-03-03 11:34:09 +02:00
parent 55e93a9087
commit 5960e94da5
35 changed files with 183 additions and 29 deletions

View File

@@ -1,4 +1,6 @@
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
@@ -8,6 +10,12 @@ def users(request):
:return:
"""
if not request.user.is_authenticated():
return HttpResponseRedirect(reverse('index'))
if not request.user.is_superuser:
return HttpResponseRedirect(reverse('index'))
users = User.objects.filter(is_staff=False, is_superuser=False)
return render(request, 'users.html', locals())
@@ -18,6 +26,12 @@ def user(request, user_id):
:return:
"""
if not request.user.is_authenticated():
return HttpResponseRedirect(reverse('index'))
if not request.user.is_superuser:
return HttpResponseRedirect(reverse('index'))
user = User.objects.get(id=user_id)
return render(request, 'user.html', locals())