예제 #1
0
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")))
예제 #2
0
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"))
예제 #3
0
파일: views.py 프로젝트: HalasNet/felix
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"))
        )
예제 #4
0
파일: views.py 프로젝트: HalasNet/felix
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")
        )