From 6d5d279f6139f909bc3941781966f93e0f36f83f Mon Sep 17 00:00:00 2001 From: yumaojun <719118794@qq.com> Date: Sat, 14 Nov 2015 10:16:48 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=A2=9E=E5=8A=A0=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E8=A7=84=E5=88=99=E7=9A=84=E6=B7=BB=E5=8A=A0=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=EF=BC=8C=E7=BC=96=E8=BE=91=EF=BC=8C=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E3=80=82=202.=20=E4=BF=AE=E6=94=B9nav.html?= =?UTF-8?q?=E4=B8=AD=E5=85=B3=E4=BA=8E=E6=8E=88=E6=9D=83=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E3=80=82=203.=20=E4=BF=AE=E6=94=B9Jasset=20A?= =?UTF-8?q?PP=20=E4=B8=8B=E7=9A=84=20view=EF=BC=8C=E4=BD=BF=E5=BE=97?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E4=B8=AD=E5=AD=98=E5=82=A8=E7=9A=84?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E6=98=AF=E6=98=8E=E6=96=87=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jperm/urls.py | 2 +- jperm/views.py | 16 ++++++++++------ templates/jperm/perm_rules.html | 32 ++++++++++++++++++++++++-------- templates/nav.html | 4 ++-- 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/jperm/urls.py b/jperm/urls.py index ea7c2def7..16eea4951 100644 --- a/jperm/urls.py +++ b/jperm/urls.py @@ -2,7 +2,7 @@ from django.conf.urls import patterns, include, url from jperm.views import * urlpatterns = patterns('jperm.views', - (r'^user/$', perm_rules), + (r'^rule/$', perm_rules), (r'^perm_rule_add/$', perm_rule_add), (r'^perm_rule_detail/$', perm_rule_detail), (r'^perm_rule_edit/$', perm_rule_edit), diff --git a/jperm/views.py b/jperm/views.py index 22d36dddf..d34e9d90a 100644 --- a/jperm/views.py +++ b/jperm/views.py @@ -198,12 +198,16 @@ def perm_rule_delete(request): :param request: :return: """ - # 根据rule_id 取得rule对象 - rule_id = request.GET.get("id") - rule_obj = PermRule.objects.get(id=rule_id) - - if request.method == 'POST' and rule_id: - return HttpResponse("uncompleted") + if request.method == 'POST': + # 根据rule_id 取得rule对象 + rule_id = request.POST.get("id") + rule_obj = PermRule.objects.get(id=rule_id) + print rule_id, rule_obj + print rule_obj.name + rule_obj.delete() + return HttpResponse(u"删除授权规则:%s" % rule_obj.name) + else: + return HttpResponse(u"不支持该操作") diff --git a/templates/jperm/perm_rules.html b/templates/jperm/perm_rules.html index 758caf708..20c0fe831 100644 --- a/templates/jperm/perm_rules.html +++ b/templates/jperm/perm_rules.html @@ -50,9 +50,9 @@ 操作 - + {% for rule in rules %} - + {{ rule.name }} {{ rule | rule_member_count:"user" }} @@ -72,7 +72,7 @@ 详情 编辑 - 删除 + {% endfor %} @@ -92,13 +92,29 @@ -{% endblock %} + - \ No newline at end of file diff --git a/templates/nav.html b/templates/nav.html index 08a68b620..30ca9ebdd 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -28,7 +28,7 @@ 授权管理 + d
  • 日志审计