def other_perms_view(request, permission, user, target, redirect_to=None): if request.method == "POST": give_permission_to(user, permission, target) redirect_to = redirect_to or reverse("test_view_crud") return HttpResponseRedirect(redirect_to) else: return HttpResponse(""" Do you want to get %s permission for obj %s? <form action="" method="POST"> <input type="submit" value="Yes" /> <input type="button" value="No" onclick="document.location='%s'" /> </form> """ % (permission.name, target, reverse("test_view_crud")))
def add_perms_view(request, permission, user, target, redirect_to=None): if request.method == "POST": give_permission_to(user, permission, target) redirect_to = redirect_to or reverse("test_view_crud") return HttpResponseRedirect(redirect_to) else: return HttpResponse(""" Do you want to get permissions to create PermissionTestClass instances? <form action="" method="POST"> <input type="submit" value="Yes" /> <input type="button" value="No" onclick="document.location='%s'" /> </form> """ % reverse("test_view_crud"))
def other_perms_view(request, permission, user, target, redirect_to=None): if request.method == "POST": give_permission_to(user, permission, target) redirect_to = redirect_to or reverse("test_view_crud") return HttpResponseRedirect(redirect_to) else: return HttpResponse( """ Do you want to get %s permission for obj %s? <form action="" method="POST"> <input type="submit" value="Yes" /> <input type="button" value="No" onclick="document.location='%s'" /> </form> """ % (permission.name, target, reverse("test_view_crud")) )
def add_perms_view(request, permission, user, target, redirect_to=None): if request.method == "POST": give_permission_to(user, permission, target) redirect_to = redirect_to or reverse("test_view_crud") return HttpResponseRedirect(redirect_to) else: return HttpResponse( """ Do you want to get permissions to create PermissionTestClass instances? <form action="" method="POST"> <input type="submit" value="Yes" /> <input type="button" value="No" onclick="document.location='%s'" /> </form> """ % reverse("test_view_crud") )