From 6b2310ff38f64e037b75fd7e7a5a29bc9ecfc11a Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 23 Jan 2015 00:07:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4=E7=94=A8?= =?UTF-8?q?=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- juser/views.py | 9 +++++++++ templates/juser/user_list.html | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/juser/views.py b/juser/views.py index 543a667d1..7e5ae94ec 100644 --- a/juser/views.py +++ b/juser/views.py @@ -178,6 +178,15 @@ def user_detail(request): return render_to_response('juser/user_detail.html', locals()) +def user_del(request): + username = request.GET.get('username', None) + if not username: + return HttpResponseRedirect('/') + user = User.objects.get(username=username) + user.delete() + return HttpResponseRedirect('/juser/user_list/', locals()) + + def db_add_user(**kwargs): groups_post = kwargs.pop('groups') user = User(**kwargs) diff --git a/templates/juser/user_list.html b/templates/juser/user_list.html index adc324b2e..7e8a7ba5a 100644 --- a/templates/juser/user_list.html +++ b/templates/juser/user_list.html @@ -59,9 +59,9 @@ {{ user.email }} {{ user.is_active|bool2str }} - 详情 - 编辑 - 删除 + 详情 + 编辑 + 删除 {% endfor %}