The views module provides the Views you will most probably
be subclassing in your implementation.
By setting or modifying class attributes on your view, you change it’s predefined behaviour.
-
class views.View(**kwargs)[source]
Handles incoming requests and maps them to REST operations.
Performs request deserialization, response serialization, authentication and input validation.
-
resource = None
List of renderers the resource can serialize the response with, ordered by preference.
-
renderers = (<class 'djangorestframework.renderers.JSONRenderer'>, <class 'djangorestframework.renderers.DocumentingHTMLRenderer'>, <class 'djangorestframework.renderers.DocumentingXHTMLRenderer'>, <class 'djangorestframework.renderers.DocumentingPlainTextRenderer'>, <class 'djangorestframework.renderers.XMLRenderer'>)
List of parsers the resource can parse the request with.
-
parsers = (<class 'djangorestframework.parsers.JSONParser'>, <class 'djangorestframework.parsers.FormParser'>, <class 'djangorestframework.parsers.MultiPartParser'>, <class 'djangorestframework.parsers.XMLParser'>)
List of all authenticating methods to attempt.
-
authentication = (<class 'djangorestframework.authentication.UserLoggedInAuthentication'>, <class 'djangorestframework.authentication.BasicAuthentication'>)
List of all permissions that must be checked.
-
classmethod as_view(**initkwargs)[source]
Override the default as_view() to store an instance of the view
as an attribute on the callable function. This allows us to discover
information about the view when we do URL reverse lookups.
-
allowed_methods[source]
Return the list of allowed HTTP methods, uppercased.
-
http_method_not_allowed(request, *args, **kwargs)[source]
Return an HTTP 405 error if an operation is called which does not have a handler method.
-
initial(request, *args, **kargs)[source]
Hook for any code that needs to run prior to anything else.
Required if you want to do things like set request.upload_handlers before
the authentication and dispatch handling is run.
Add field and value to the headers attribute of the View class.
-
class views.ModelView(**kwargs)[source]
A RESTful view that maps to a model in the database.
-
resource
alias of ModelResource
-
class views.InstanceModelView(**kwargs)[source]
A view which provides default operations for read/update/delete against a model instance.
-
class views.ListModelView(**kwargs)[source]
A view which provides default operations for list, against a model in the database.
-
class views.ListOrCreateModelView(**kwargs)[source]
A view which provides default operations for list and create, against a model in the database.