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 @@