diff --git a/djangorestframework/resources.py b/djangorestframework/resources.py index 192d134cb..dc540c6b4 100644 --- a/djangorestframework/resources.py +++ b/djangorestframework/resources.py @@ -7,7 +7,7 @@ from djangorestframework.response import ErrorResponse from djangorestframework.serializer import Serializer, _SkipField -class BaseResource(Serializer): +class BaseResource(object): """ Base class for all Resource classes, which simply defines the interface they provide. @@ -31,7 +31,7 @@ class BaseResource(Serializer): Typically raises a :exc:`response.ErrorResponse` with status code 400 (Bad Request) on failure. """ - return data + raise NotImplementedError() def retrieve(self, *args, **kwargs): raise NotImplementedError() @@ -52,7 +52,7 @@ class BaseResource(Serializer): return not self.instance is None -class Resource(BaseResource): +class Resource(Serializer, BaseResource): """ A Resource determines how a python object maps to some serializable data. Objects that a resource can act on include plain Python object instances, @@ -74,6 +74,9 @@ class Resource(BaseResource): # you should explicitly set the fields attribute on your class. fields = None + def deserialize(self, data, files=None): + return data + class FormResource(Resource): """ diff --git a/djangorestframework/views.py b/djangorestframework/views.py index f93356d79..03347266b 100644 --- a/djangorestframework/views.py +++ b/djangorestframework/views.py @@ -201,10 +201,11 @@ class ListModelView(ListResourceMixin, ModelView): A view which provides default operations for list, against a model in the database. """ + queryset = None _suffix = 'List' -class ListOrCreateModelView(PostResourceMixin, ListResourceMixin, ModelView): +class ListOrCreateModelView(PostResourceMixin, ListModelView, ModelView): """ A view which provides default operations for list and create, against a model in the database.