Ejemplo n.º 1
0
def systemlist(request):
    if not request.user.is_authenticated:
        return render(request, "login.html", {'login_failed': False, 'is_authenticated': False})
    if not request.user.is_superuser:
        return HttpResponseRedirect('/myprofile/')
    system_size = getFileSize("")
    system_files = getFiles("")
    user = request.user
    return render(request, "system.html", {
        'username': user.username,
        'is_admin': isAdmin(user.id),
        'files': system_files,
        'size': system_size
    })
Ejemplo n.º 2
0
def userlist(request):
    if not request.user.is_authenticated:
        return render(request, "login.html", {'login_failed': False, 'is_authenticated': False})
    if not request.user.is_superuser:
        return HttpResponseRedirect('/myprofile/')
    userlist = []
    for user in User.objects.all():
        userinfo = []
        userinfo.append(user.username)
        userinfo.append(getFileSize(user.id))
        userlist.append(userinfo)
    user = request.user
    return render(request, "userlist.html", {
        'username': user.username,
        'is_admin': isAdmin(user.id),
        'users': userlist,
    })