mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 15:45:23 +00:00
37 lines
No EOL
915 B
Python
37 lines
No EOL
915 B
Python
from django.shortcuts import render
|
|
from django.http import HttpResponseRedirect
|
|
from django.core.urlresolvers import reverse
|
|
from django.contrib.auth.models import User
|
|
|
|
|
|
def users(request):
|
|
"""
|
|
:param 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())
|
|
|
|
def user(request, user_id):
|
|
"""
|
|
:param request:
|
|
: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()) |