class GenericAPIView(views.APIView): (source)
Known subclasses: rest_framework.generics.CreateAPIView
, rest_framework.generics.DestroyAPIView
, rest_framework.generics.ListAPIView
, rest_framework.generics.ListCreateAPIView
, rest_framework.generics.RetrieveAPIView
, rest_framework.generics.RetrieveDestroyAPIView
, rest_framework.generics.RetrieveUpdateAPIView
, rest_framework.generics.RetrieveUpdateDestroyAPIView
, rest_framework.generics.UpdateAPIView
, rest_framework.viewsets.GenericViewSet
Base class for all other generic views.
Method | filter |
Given a queryset, filter it with whichever filter backend is in use. |
Method | get |
Returns the object the view is displaying. |
Method | get |
Return a paginated style `Response` object for the given output data. |
Method | get |
Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using `self.queryset`. |
Method | get |
Return the serializer instance that should be used for validating and deserializing input, and for serializing output. |
Method | get |
Return the class to use for the serializer. Defaults to using `self.serializer_class`. |
Method | get |
Extra context provided to the serializer class. |
Method | paginate |
Return a single page of results, or `None` if pagination is disabled. |
Class Variable | lookup |
Undocumented |
Class Variable | lookup |
Undocumented |
Class Variable | queryset |
Undocumented |
Class Variable | serializer |
Undocumented |
Property | paginator |
The paginator instance associated with the view, or `None`. |
Inherited from APIView
:
Class Method | as |
Store the original class on the view function. |
Method | check |
Check if the request should be permitted for a given object. Raises an appropriate exception if the request is not permitted. |
Method | check |
Check if the request should be permitted. Raises an appropriate exception if the request is not permitted. |
Method | check |
Check if request should be throttled. Raises an appropriate exception if the request is throttled. |
Method | determine |
If versioning is being used, then determine any API version for the incoming request. Returns a two-tuple of (version, versioning_scheme) |
Method | dispatch |
`.dispatch()` is pretty much the same as Django's regular dispatch, but with extra hooks for startup, finalize, and exception handling. |
Method | finalize |
Returns the final response object. |
Method | get |
If a request is unauthenticated, determine the WWW-Authenticate header to use for 401 responses, if any. |
Method | get |
Instantiates and returns the list of authenticators that this view can use. |
Method | get |
Instantiate and return the content negotiation class to use. |
Method | get |
Returns the exception handler that this view uses. |
Method | get |
Returns a dict that is passed through to EXCEPTION_HANDLER, as the `context` argument. |
Method | get |
Determine if the request includes a '.json' style format suffix |
Method | get |
Returns a dict that is passed through to Parser.parse(), as the `parser_context` keyword argument. |
Method | get |
Instantiates and returns the list of parsers that this view can use. |
Method | get |
Instantiates and returns the list of permissions that this view requires. |
Method | get |
Returns a dict that is passed through to Renderer.render(), as the `renderer_context` keyword argument. |
Method | get |
Instantiates and returns the list of renderers that this view can use. |
Method | get |
Instantiates and returns the list of throttles that this view uses. |
Method | get |
Return some descriptive text for the view, as used in OPTIONS responses and in the browsable API. |
Method | get |
Return the view name, as used in OPTIONS responses and in the browsable API. |
Method | handle |
Handle any exception that occurs, by returning an appropriate response, or re-raising the error. |
Method | http |
If `request.method` does not correspond to a handler method, determine what kind of exception to raise. |
Method | initial |
Runs anything that needs to occur prior to calling the method handler. |
Method | initialize |
Returns the initial request object. |
Method | options |
Handler method for HTTP 'OPTIONS' request. |
Method | perform |
Perform authentication on the incoming request. |
Method | perform |
Determine which renderer and media type to use render the response. |
Method | permission |
If request is not permitted, determine what kind of exception to raise. |
Method | raise |
Undocumented |
Method | throttled |
If request is throttled, determine what kind of exception to raise. |
Class Variable | schema |
Undocumented |
Instance Variable | args |
Undocumented |
Instance Variable | format |
Undocumented |
Instance Variable | headers |
Undocumented |
Instance Variable | kwargs |
Undocumented |
Instance Variable | request |
Undocumented |
Instance Variable | response |
Undocumented |
Property | allowed |
Wrap Django's private `_allowed_methods` interface in a public property. |
Property | default |
Undocumented |
Instance Variable | _negotiator |
Undocumented |
Given a queryset, filter it with whichever filter backend is in use. You are unlikely to want to override this method, although you may need to call it either from a list view, or from a custom `get_object` method if you want to apply the configured filtering backend to the default queryset.
Returns the object the view is displaying. You may want to override this if you need to provide non-standard queryset lookups. Eg if objects are referenced using multiple keyword arguments in the url conf.
Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using `self.queryset`. This method should always be used rather than accessing `self.queryset` directly, as `self.queryset` gets evaluated only once, and those results are cached for all subsequent requests. You may want to override this if you need to provide different querysets depending on the incoming request. (Eg. return a list of items that is specific to the user)
Return the serializer instance that should be used for validating and deserializing input, and for serializing output.
Return the class to use for the serializer. Defaults to using `self.serializer_class`. You may want to override this if you need to provide different serializations depending on the incoming request. (Eg. admins get full serialization, others get basic serialization)