diff options
| author | Tom Christie | 2011-05-13 17:19:12 +0100 |
|---|---|---|
| committer | Tom Christie | 2011-05-13 17:19:12 +0100 |
| commit | 325e63a3a767bf4aedef7be616cc268a08537424 (patch) | |
| tree | df9bb4f81a569df85ef2d0dd5dfd4f111e633522 /djangorestframework/views.py | |
| parent | 8f6bcac7f3f156831343cc7fec79f624dcc2639f (diff) | |
| download | django-rest-framework-325e63a3a767bf4aedef7be616cc268a08537424.tar.bz2 | |
Sorting out resources. Doing some crazy magic automatic url resolving stuff. Yum.
Diffstat (limited to 'djangorestframework/views.py')
| -rw-r--r-- | djangorestframework/views.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/djangorestframework/views.py b/djangorestframework/views.py index 315c25a9..2e7e8418 100644 --- a/djangorestframework/views.py +++ b/djangorestframework/views.py @@ -18,8 +18,10 @@ __all__ = ( class BaseView(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, View): - """Handles incoming requests and maps them to REST operations. - Performs request deserialization, response serialization, authentication and input validation.""" + """ + Handles incoming requests and maps them to REST operations. + Performs request deserialization, response serialization, authentication and input validation. + """ # Use the base resource by default resource = resources.Resource @@ -77,8 +79,8 @@ class BaseView(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, View): prefix = '%s://%s' % (request.is_secure() and 'https' or 'http', request.get_host()) set_script_prefix(prefix) - try: - # Authenticate and check request is has the relevant permissions + try: + # Authenticate and check request has the relevant permissions self._check_permissions() # Get the appropriate handler method @@ -98,7 +100,7 @@ class BaseView(ResourceMixin, RequestMixin, ResponseMixin, AuthMixin, View): response = Response(status.HTTP_204_NO_CONTENT) # Pre-serialize filtering (eg filter complex objects into natively serializable types) - response.cleaned_content = self.object_to_data(response.raw_content) + response.cleaned_content = self.filter_response(response.raw_content) except ErrorResponse, exc: response = exc.response @@ -118,7 +120,7 @@ class ModelView(BaseView): """A RESTful view that maps to a model in the database.""" resource = resources.ModelResource -class InstanceModelView(ReadModelMixin, UpdateModelMixin, DeleteModelMixin, ModelView): +class InstanceModelView(InstanceMixin, ReadModelMixin, UpdateModelMixin, DeleteModelMixin, ModelView): """A view which provides default operations for read/update/delete against a model instance.""" pass |
