From b86fe492c3fc4be9955e486ebd4d80c8d7771448 Mon Sep 17 00:00:00 2001 From: lhark Date: Sat, 2 Jul 2016 02:07:17 +0200 Subject: [PATCH] Users app index now list users --- users/views.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/users/views.py b/users/views.py index 1136c437..8c6f0b61 100644 --- a/users/views.py +++ b/users/views.py @@ -7,7 +7,7 @@ from django.core.context_processors import csrf from django.template import Context, RequestContext, loader from django.contrib import messages -from users.models import User, UserForm, InfoForm, PasswordForm, StateForm +from users.models import User, UserForm, InfoForm, PasswordForm, StateForm, RightForm from users.forms import PassForm from re2o.login import makeSecret, hashNT @@ -65,5 +65,12 @@ def password(request, userid): user.save() return form({'userform': user_form}, 'users/user.html', request) +def add_right(request): + right = RightForm(request.POST or None) + if right.is_valid(): + right.save() + return form({'userform': right}, 'users/user.html', request) + def index(request): - return render(request, 'users/index.html') + users_list = User.objects.order_by('pk') + return render(request, 'users/index.html', {'users_list': users_list})