diff options
| author | Tom Christie | 2012-10-02 19:54:24 +0100 |
|---|---|---|
| committer | Tom Christie | 2012-10-02 19:54:24 +0100 |
| commit | e1518de68fa9ad4b2628894abf17924e386ccbda (patch) | |
| tree | b1d190f6bd08ce087cf0a2d3e8cd681b5e7e7d04 /docs/api-guide/authentication.md | |
| parent | 31b06f1721f98730556dc56927b985e4032788c3 (diff) | |
| parent | d1b99f350aded62fe480f7dc4749cd63d52715d2 (diff) | |
| download | django-rest-framework-e1518de68fa9ad4b2628894abf17924e386ccbda.tar.bz2 | |
Merge branch 'restframework2' of https://github.com/tomchristie/django-rest-framework into restframework2
Diffstat (limited to 'docs/api-guide/authentication.md')
| -rw-r--r-- | docs/api-guide/authentication.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/api-guide/authentication.md b/docs/api-guide/authentication.md index f24c6a81..c6995360 100644 --- a/docs/api-guide/authentication.md +++ b/docs/api-guide/authentication.md @@ -39,6 +39,7 @@ You can also set the authentication policy on a per-view basis, using the `APIVi class ExampleView(APIView): authentication_classes = (SessionAuthentication, UserBasicAuthentication) + permission_classes = (IsAuthenticated,) def get(self, request, format=None): content = { @@ -49,10 +50,9 @@ You can also set the authentication policy on a per-view basis, using the `APIVi Or, if you're using the `@api_view` decorator with function based views. - @api_view( - allowed=('GET',), - authentication_classes=(SessionAuthentication, UserBasicAuthentication) - ) + @api_view('GET'), + @authentication_classes(SessionAuthentication, UserBasicAuthentication) + @permissions_classes(IsAuthenticated) def example_view(request, format=None): content = { 'user': unicode(request.user), # `django.contrib.auth.User` instance. |
