django_socio_grpc.generics
Module Contents
Classes
Base class for all other generic services. |
|
Concrete service for creating a model instance that provides a |
|
Concrete service for listing a queryset that provides a |
|
Concrete service for listing one by one on streaming a queryset that provides a |
|
Concrete service for retrieving a model instance that provides a
|
|
Concrete service for deleting a model instance that provides a |
|
Concrete service for updating a model instance that provides a
|
|
Concrete service for listing a queryset that provides a |
|
Concrete service that provides default |
|
Concrete service that provides default |
|
Concrete service for creating a model instance that provides a |
|
Concrete service for listing a queryset that provides a |
|
Concrete service for listing one by one on streaming a queryset that provides a |
|
Concrete service for retrieving a model instance that provides a
|
|
Concrete service for deleting a model instance that provides a |
|
Concrete service for updating a model instance that provides a
|
|
Concrete service for listing a queryset that provides a |
|
Concrete service that provides default |
|
Concrete service that provides default |
Data
API
- django_socio_grpc.generics.logger
‘getLogger(…)’
- class django_socio_grpc.generics.GenericService(**kwargs)
Bases:
django_socio_grpc.services.ServiceBase class for all other generic services.
Initialization
Set kwargs as self attributes.
- serializer_class: django_socio_grpc.proto_serializers.ProtoSerializer | None
None
- classmethod get_service_name()
- get_queryset()
Get the list of items for this service. This must be an iterable, and may be a queryset. Defaults to using
self.queryset.If you are overriding a handler method, it is important that you call
get_queryset()instead of accessing thequerysetattribute asquerysetwill get evaluated only once.Override this to provide dynamic behavior, for example::
def get_queryset(self): if self.action == 'ListSpecialUser': return SpecialUser.objects.all() return super().get_queryset()
- get_serializer_class()
Return the class to use for the serializer. Defaults to using
self.serializer_class.
- get_lookup_request_field(queryset=None)
- get_object()
Returns an object instance that should be used for detail services. Defaults to using the lookup_field parameter to filter the base queryset.
- async aget_object()
Returns an object instance that should be used for detail services. Defaults to using the lookup_field parameter to filter the base queryset.
- get_serializer(*args, **kwargs)
Return the serializer instance that should be used for validating and deserializing input, and for serializing output.
- async aget_serializer(*args, **kwargs)
- get_serializer_context()
Extra context provided to the serializer class. Defaults to including
grpc_request,grpc_context, andservicekeys.
- filter_queryset(queryset)
Given a queryset, filter it, returning a new queryset.
- async afilter_queryset(queryset)
Given a queryset, filter it, returning a new queryset.
- property paginator
The paginator instance associated with the view, or
None.
- paginate_queryset(queryset)
Return a single page of results, or
Noneif pagination is disabled.
- class django_socio_grpc.generics.CreateService(**kwargs)
Bases:
django_socio_grpc.mixins.CreateModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for creating a model instance that provides a
Create()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.ListService(**kwargs)
Bases:
django_socio_grpc.mixins.ListModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for listing a queryset that provides a
List()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.StreamService(**kwargs)
Bases:
django_socio_grpc.mixins.StreamModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for listing one by one on streaming a queryset that provides a
Stream()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.RetrieveService(**kwargs)
Bases:
django_socio_grpc.mixins.RetrieveModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for retrieving a model instance that provides a
Retrieve()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.DestroyService(**kwargs)
Bases:
django_socio_grpc.mixins.DestroyModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for deleting a model instance that provides a
Destroy()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.UpdateService(**kwargs)
Bases:
django_socio_grpc.mixins.UpdateModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for updating a model instance that provides a
Update()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.ListCreateService(**kwargs)
Bases:
django_socio_grpc.mixins.ListModelMixin,django_socio_grpc.mixins.CreateModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for listing a queryset that provides a
List()andCreate()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.ReadOnlyModelService(**kwargs)
Bases:
django_socio_grpc.mixins.RetrieveModelMixin,django_socio_grpc.mixins.ListModelMixin,django_socio_grpc.generics.GenericServiceConcrete service that provides default
List()andRetrieve()handlers.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.ModelService(**kwargs)
Bases:
django_socio_grpc.mixins.CreateModelMixin,django_socio_grpc.mixins.RetrieveModelMixin,django_socio_grpc.mixins.UpdateModelMixin,django_socio_grpc.mixins.DestroyModelMixin,django_socio_grpc.mixins.ListModelMixin,django_socio_grpc.mixins.PartialUpdateModelMixin,django_socio_grpc.generics.GenericServiceConcrete service that provides default
Create(),Retrieve(),Update(),Destroy()andList()handlers.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.AsyncCreateService(**kwargs)
Bases:
django_socio_grpc.mixins.AsyncCreateModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for creating a model instance that provides a
Create()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.AsyncListService(**kwargs)
Bases:
django_socio_grpc.mixins.AsyncListModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for listing a queryset that provides a
List()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.AsyncStreamService(**kwargs)
Bases:
django_socio_grpc.mixins.AsyncStreamModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for listing one by one on streaming a queryset that provides a
Stream()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.AsyncRetrieveService(**kwargs)
Bases:
django_socio_grpc.mixins.AsyncRetrieveModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for retrieving a model instance that provides a
Retrieve()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.AsyncDestroyService(**kwargs)
Bases:
django_socio_grpc.mixins.AsyncDestroyModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for deleting a model instance that provides a
Destroy()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.AsyncUpdateService(**kwargs)
Bases:
django_socio_grpc.mixins.AsyncUpdateModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for updating a model instance that provides a
Update()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.AsyncListCreateService(**kwargs)
Bases:
django_socio_grpc.mixins.AsyncListModelMixin,django_socio_grpc.mixins.AsyncCreateModelMixin,django_socio_grpc.generics.GenericServiceConcrete service for listing a queryset that provides a
List()andCreate()handler.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.AsyncReadOnlyModelService(**kwargs)
Bases:
django_socio_grpc.mixins.AsyncRetrieveModelMixin,django_socio_grpc.mixins.AsyncListModelMixin,django_socio_grpc.generics.GenericServiceConcrete service that provides default
List()andRetrieve()handlers.Initialization
Set kwargs as self attributes.
- class django_socio_grpc.generics.AsyncModelService(**kwargs)
Bases:
django_socio_grpc.mixins.AsyncCreateModelMixin,django_socio_grpc.mixins.AsyncRetrieveModelMixin,django_socio_grpc.mixins.AsyncUpdateModelMixin,django_socio_grpc.mixins.AsyncDestroyModelMixin,django_socio_grpc.mixins.AsyncListModelMixin,django_socio_grpc.mixins.AsyncPartialUpdateModelMixin,django_socio_grpc.generics.GenericServiceConcrete service that provides default
Create(),Retrieve(),Update(),Destroy()andList()handlers.Initialization
Set kwargs as self attributes.