diff options
| author | Tom Christie | 2011-07-01 17:44:08 +0100 | 
|---|---|---|
| committer | Tom Christie | 2011-07-01 17:44:08 +0100 | 
| commit | f7b7778a79bad4124a6f50bf461f206a6d71fa90 (patch) | |
| tree | 2bd1b84a90dec5724cda3d89b3a9faf5ca298961 /examples/permissionsexample/views.py | |
| parent | c3babe751a6bab7c7888f173b7853a65ba2ea35e (diff) | |
| parent | f67c0651baf1cea65221b4fb7f4df11a54abed90 (diff) | |
| download | django-rest-framework-f7b7778a79bad4124a6f50bf461f206a6d71fa90.tar.bz2 | |
pull in markos changes, minor tweaks to yaml stuff
Diffstat (limited to 'examples/permissionsexample/views.py')
| -rw-r--r-- | examples/permissionsexample/views.py | 22 | 
1 files changed, 20 insertions, 2 deletions
| diff --git a/examples/permissionsexample/views.py b/examples/permissionsexample/views.py index 20e7cba7..f95c2c84 100644 --- a/examples/permissionsexample/views.py +++ b/examples/permissionsexample/views.py @@ -1,6 +1,16 @@  from djangorestframework.views import View -from djangorestframework.permissions import PerUserThrottling +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')},] +          class ThrottlingExampleView(View):      """ @@ -17,4 +27,12 @@ class ThrottlingExampleView(View):          """          Handle GET requests.          """ -        return "Successful response to GET request because throttle is not yet active."
\ No newline at end of file +        return "Successful response to GET request because throttle is not yet active." +     +class LoggedInExampleView(View): +    """ +    You can login with **'test', 'test'.**  +    """ +    permissions = (IsAuthenticated, ) +    def get(self, request): +        return 'Logged in or not?'
\ No newline at end of file | 
