diff options
| author | Tom Christie | 2013-08-21 19:46:09 +0100 |
|---|---|---|
| committer | Tom Christie | 2013-08-21 19:46:09 +0100 |
| commit | 5e40e50f2b187fe2ff2e8ee63b4e39ece42f1521 (patch) | |
| tree | fff155cd7be62d61204806ac4bde14eeec8691da /docs/api-guide/permissions.md | |
| parent | f84d4951bfcc8887d57ca5fa0321cfdbb18a9b6d (diff) | |
| download | django-rest-framework-5e40e50f2b187fe2ff2e8ee63b4e39ece42f1521.tar.bz2 | |
Include import paths throughout docs.
Closes #1051. Thanks to @pydanny for the report.
Diffstat (limited to 'docs/api-guide/permissions.md')
| -rw-r--r-- | docs/api-guide/permissions.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md index c6372f98..a3d86ed4 100644 --- a/docs/api-guide/permissions.md +++ b/docs/api-guide/permissions.md @@ -47,6 +47,10 @@ If not specified, this setting defaults to allowing unrestricted access: You can also set the authentication policy on a per-view, or per-viewset basis, using the `APIView` class based views. + from rest_framework.permissions import IsAuthenticated + from rest_framework.responses import Response + from rest_framework.views import APIView + class ExampleView(APIView): permission_classes = (IsAuthenticated,) @@ -157,6 +161,8 @@ For more details see the [2.2 release announcement][2.2-announcement]. The following is an example of a permission class that checks the incoming request's IP address against a blacklist, and denies the request if the IP has been blacklisted. + from rest_framework import permissions + class BlacklistPermission(permissions.BasePermission): """ Global permission check for blacklisted IPs. |
