rest_framework_dso.views module
- class rest_framework_dso.views.AutoSelectPaginationClass(default=None)
Bases:
object
An @classproperty for the pagination
- __init__(default=None)
- class rest_framework_dso.views.DSOViewMixin
Bases:
object
View/Viewset mixin that adds DSO-compatible API’s
This adds: * HTTP Accept-Crs and HTTP POST Content-Crs support. * Default filter backends in the view for sorting and filtering. The filtering logic is delegated to a
filterset_class
by django-filter.Usage: * Set
filterset_class
to enable filtering on fields. * Theordering_fields
can be set on the view as well. By default, it accepts all serializer field names as input.- accept_crs = frozenset({CRS(domain='ogc', authority='EPSG', version='', crsid='4326', srid=4326, backend=None, origin=4326, has_custom_backend=False), CRS(domain='ogc', authority='EPSG', version='', crsid='4258', srid=4258, backend=None, origin='EPSG:4258', has_custom_backend=False), CRS(domain='ogc', authority='EPSG', version='', crsid='3857', srid=3857, backend=None, origin='EPSG:3857', has_custom_backend=False), CRS(domain='ogc', authority='EPSG', version='', crsid='28992', srid=28992, backend=None, origin='EPSG:28992', has_custom_backend=False)})
The list of allowed coordinate reference systems for the request header
- finalize_response(request, response, *args, **kwargs)
Set the Content-Crs header if there was a geometry field.
Also restore streaming support if the output media uses generators.
- get_serializer(*args, **kwargs)
Updated to allow extra modifications to the serializer
- get_view_description(**kwargs)
- initial(request, *args, **kwargs)
- pagination_class
Paginator class
alias of
DSOPageNumberPagination
- parser_classes = [<class 'rest_framework_dso.parsers.DSOJsonParser'>]
Enforce parsing Content-Crs for POST requests:
- property table_schema: DatasetTableSchema
- rest_framework_dso.views.bad_request(request, exception, *args, **kwargs)
Generic 400 error handler.
- rest_framework_dso.views.exception_handler(exc, context)
Return the exceptions as ‘application/problem+json’.
- rest_framework_dso.views.get_invalid_params(exc: ValidationError, detail: Union[ErrorDetail, dict, list], field_name=None) list
Flatten the entire chain of DRF messages. This can be a recursive tree for POST requests with complex serializer data.
- rest_framework_dso.views.get_view_name(view: APIView)
Given a view instance, return a textual name to represent the view. This name is used in the browsable API, and in OPTIONS responses.
This function replaces the Rest Framework default, configured in settings using:
REST_FRAMEWORK['VIEW_NAME_FUNCTION']
- rest_framework_dso.views.multiple_slashes(request)
- rest_framework_dso.views.not_found(request, exception, *args, **kwargs)
Generic 404 error handler.
- rest_framework_dso.views.server_error(request, *args, **kwargs)
Generic 500 error handler.