Class based Views¶
REST Views¶
Fusionbox generic views.
-
class
fusionbox.views.
RestView
(**kwargs)[source]¶ Inherit this base class to implement a REST view.
- This view will handle:
- authentication (throuh the
auth
method) - dispatching to the proper HTTP method function
- returning a proper error status code.
- authentication (throuh the
It also implements a default response for the OPTIONS HTTP request method.
-
auth
(*args, **kwargs)[source]¶ Hook for implementing custom authentication.
Raises
NotImplementedError
by default. Subclasses must overwrite this.
REST View Mixins¶
View classes to help facilitate the creation of REST APIs
-
class
fusionbox.views.rest.
JsonRequestMixin
[source]¶ Adds a
data
method on the view instance. It returns the GET parameters if it is a GET request. It will return the python representation of the JSON sent with the request body.
-
class
fusionbox.views.rest.
JsonResponseMixin
[source]¶ Sets the response MIME type to
application/json
and serializes the context obj as a JSON string.-
http_method_not_allowed
(*args, **kwargs)[source]¶ Returns super after setting the Content-Type header to
application/json
-