views#
SystemCreatorViewSet#
Bases: AccessViewSetMixin
, ModelViewSet
Source code in src/apps/common/views.py
StandardResultsSetPagination#
PatchModelMixin#
ViewSet mixin for patch support in partial update.
The ViewSet needs to use a serializer based on PatchModelSerializer. Otherwise the serializer raises an error about unexpected 'patch' argument.
Source code in src/apps/common/views.py
update(request, *args, **kwargs)
#
Like UpdateModelMixin.update but with support for 'patch' kwarg.
Source code in src/apps/common/views.py
CommonQueryParamsSerializer#
QueryParamsMixin#
Bases: ViewSet
ViewSet mixin for parsing query params with serializers.
Provides query_params
attribute that validates query parameters
using serializers assigned to the view action.
The serializers are configured with the
added query_serializers ViewSet class attribute.
The query_serializers attribute should be a list of dicts with
- class
: Serializer class used for parsing query parameters.
- actions
: Optional list to limit the ViewSet actions the serializer applies to.
Example:
class SomeView(ViewSet):
query_serializers = [
{"class": SomeQueryParamsSerializer, "actions": ["list"]}
]
def list(self, request, *args, **kwargs):
params = self.query_params
...
The query serializers are also used for generating swagger docs. See the inspectors.ExtendedSwaggerAutoSchema.get_query_parameters method for details.
Source code in src/apps/common/views.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
|
include_nulls: bool
property
#
Return True if returning nulls is enabled.
strict: bool
property
#
Return True if strict parameter parsing is enabled.
get_query_serializer_classes()
#
Get query serializer classes for current action.
Source code in src/apps/common/views.py
initial(request, *args, **kwargs)
#
validate_query_params()
#
Validate query parameters for current action, assign to self.query_params.
Source code in src/apps/common/views.py
NonFilteringGetObjectMixin#
ViewSet mixin that doesn't call filter_queryset in get_object.
Normally, e.g. /datasets/<id>?title=something
will
return 404 if the title does not contain 'something'.
This is counterintuitive since it's not anywhere in
the Swagger docs. Disabling the feature should be
ok since we're not using django-filters for enforcing
permissions.
Source code in src/apps/common/views.py
get_object()
#
Identical to GenericAPIView.get_object but doesn't use filter_queryset.
Source code in src/apps/common/views.py
CommonModelViewSet#
Bases: QueryParamsMixin
, NonFilteringGetObjectMixin
, PatchModelMixin
, SystemCreatorViewSet
ViewSet with common functionality.
Source code in src/apps/common/views.py
CommonReadOnlyModelViewSet#
Bases: QueryParamsMixin
, NonFilteringGetObjectMixin
, ReadOnlyModelViewSet
ViewSet with common functionality for read only models.