From 08d42f1c2c33af3bd9c439608e3335ed4da59c4d Mon Sep 17 00:00:00 2001 From: guanghongwei Date: Sat, 24 Jan 2015 13:20:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9user=5Fedit=E5=92=8C=20group?= =?UTF-8?q?=5Fedit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- juser/urls.py | 3 +++ juser/views.py | 34 +++++++++++++++++++++++- templates/juser/group_add.html | 6 +++++ templates/juser/group_detail.html | 44 +++++++++++++++++++++++++++++++ templates/juser/group_list.html | 2 +- templates/juser/user_add.html | 4 +-- 6 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 templates/juser/group_detail.html diff --git a/juser/urls.py b/juser/urls.py index 3712b517f..d9c51dc6f 100644 --- a/juser/urls.py +++ b/juser/urls.py @@ -13,4 +13,7 @@ urlpatterns = patterns('juser.views', (r'^user_detail/$', 'user_detail'), (r'^user_del/$', 'user_del'), (r'^user_edit/$', 'user_edit'), + (r'^group_detail/$', 'group_detail'), + (r'^group_del/$', 'group_del'), + (r'^group_edit/$', 'group_edit'), ) diff --git a/juser/views.py b/juser/views.py index 102431ef9..72d7c77bc 100644 --- a/juser/views.py +++ b/juser/views.py @@ -163,6 +163,38 @@ def group_list(request): return render_to_response('juser/group_list.html', locals()) +def group_detail(request): + group_id = request.GET.get('id', None) + if not group_id: + return HttpResponseRedirect('/') + group = UserGroup.objects.get(id=group_id) + return render_to_response('juser/group_detail.html', locals()) + + +def group_del(request): + group_id = request.GET.get('id', None) + if not group_id: + return HttpResponseRedirect('/') + group = UserGroup.objects.get(id=group_id) + group.delete() + return HttpResponseRedirect('/juser/group_list/', locals()) + + +def group_edit(request): + error = '' + msg = '' + header_title, path1, path2 = '修改属组 | Edit Group', 'juser', 'group_edit' + if request.method == 'GET': + group_id = request.GET.get('id', None) + group = UserGroup.objects.get(id=group_id) + group_name = group.name + comment = group.comment + + return render_to_response('juser/group_add.html', locals()) + else: + pass + + def user_list(request): user_role = {'SU': u'超级管理员', 'GA': u'组管理员', 'CU': u'普通用户'} header_title, path1, path2 = '查看用户 | Show User', 'juser', 'user_list' @@ -200,7 +232,7 @@ def user_del(request): def user_edit(request): header_title, path1, path2 = '编辑用户 | Edit User', 'juser', 'user_edit' - hidden = "hidden" + readonly = "readonly" if request.method == 'GET': username = request.GET.get('username', None) if not username: diff --git a/templates/juser/group_add.html b/templates/juser/group_add.html index da5481b35..8de84ea00 100644 --- a/templates/juser/group_add.html +++ b/templates/juser/group_add.html @@ -34,6 +34,12 @@ {% if msg %}
{{ msg }}
{% endif %} +
diff --git a/templates/juser/group_detail.html b/templates/juser/group_detail.html new file mode 100644 index 000000000..9b906ccc0 --- /dev/null +++ b/templates/juser/group_detail.html @@ -0,0 +1,44 @@ +{% load mytags %} + + + {% include 'link_css.html' %} + + + + + +
+
+

{{ group.name }} 属组详情

+
+ + + + + + + + + + + + + + + + + + + + + +
属组详情
ID{{ group.id }}
组名{{ group.name }}
备注{{ group_comment }}
+
+
+ + \ No newline at end of file diff --git a/templates/juser/group_list.html b/templates/juser/group_list.html index 504f620e5..086dd43d2 100644 --- a/templates/juser/group_list.html +++ b/templates/juser/group_list.html @@ -30,7 +30,7 @@
diff --git a/templates/juser/user_add.html b/templates/juser/user_add.html index 4825d2add..657792157 100644 --- a/templates/juser/user_add.html +++ b/templates/juser/user_add.html @@ -35,10 +35,10 @@ {% if msg %}
{{ msg }}
{% endif %} -