apis_core.generic.api_views#
Module Contents#
Classes#
This pagination class injects a facets dict into the API response object. It looks for a get_facets method in the models class and if this method exists it uses its return value as the value of the facets key in the API response. To make the API response always paginated, we have to set the default_limit attribute to something other than None. |
|
API ViewSet for a generic model. The queryset is overridden by the first match from the first_member_match helper. The serializer class is overridden by the first match from the first_member_match helper. |
API#
- class apis_core.generic.api_views.InjectFacetsLimitOffsetPagination#
Bases:
rest_framework.pagination.LimitOffsetPaginationThis pagination class injects a facets dict into the API response object. It looks for a get_facets method in the models class and if this method exists it uses its return value as the value of the facets key in the API response. To make the API response always paginated, we have to set the default_limit attribute to something other than None.
- default_limit = 20#
- facets = None#
- paginate_queryset(queryset, request, view=None)#
- get_paginated_response(data)#
- class apis_core.generic.api_views.ModelViewSet(**kwargs)#
Bases:
rest_framework.viewsets.ModelViewSetAPI ViewSet for a generic model. The queryset is overridden by the first match from the first_member_match helper. The serializer class is overridden by the first match from the first_member_match helper.
Initialization
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- filter_backends = None#
- schema = 'GenericAutoSchema(...)'#
- pagination_class = None#
- dispatch(*args, **kwargs)#
- get_queryset()#
- get_serializer_class()#