Cleanup authentication example

This commit is contained in:
Tom Christie 2012-01-24 19:27:18 +00:00
parent 1d9f24f60d
commit 9ce864e63b

View File

@ -2,14 +2,23 @@ from djangorestframework.views import View
from djangorestframework.permissions import PerUserThrottling, IsAuthenticated
from django.core.urlresolvers import reverse
class PermissionsExampleView(View):
"""
A container view for permissions examples.
"""
def get(self, request):
return [{'name': 'Throttling Example', 'url': reverse('throttled-resource')},
{'name': 'Logged in example', 'url': reverse('loggedin-resource')},]
return [
{
'name': 'Throttling Example',
'url': reverse('throttled-resource')
},
{
'name': 'Logged in example',
'url': reverse('loggedin-resource')
},
]
class ThrottlingExampleView(View):
@ -29,6 +38,7 @@ class ThrottlingExampleView(View):
"""
return "Successful response to GET request because throttle is not yet active."
class LoggedInExampleView(View):
"""
You can login with **'test', 'test'.** or use curl:
@ -37,5 +47,6 @@ class LoggedInExampleView(View):
"""
permissions = (IsAuthenticated, )
def get(self, request):
return 'Logged in or not?'
return 'You have permission to view this resource'