Mixins
Async model action mixins for the create, list, retrieve, update, and
destroy actions. See the Mixins guide
for action flows and override hooks.
AsyncCreateModelMixin
Bases: _AsyncCRUDMixinBase
create
async
create(
request: Request, *args: Any, **kwargs: Any
) -> Response
Validates the request body, persists the instance, and returns 201.
aperform_create(serializer: BaseSerializer[Any]) -> None
Saves the new instance, awaiting serializer.asave when available.
get_success_headers(data: Any) -> dict[str, str]
Returns the headers that should be set on the 201 response.
AsyncListModelMixin
Bases: _AsyncCRUDMixinBase
list
async
list(
request: Request, *args: Any, **kwargs: Any
) -> Response
Returns a serialized, optionally paginated list of objects.
AsyncRetrieveModelMixin
Bases: _AsyncCRUDMixinBase
retrieve
async
retrieve(
request: Request, *args: Any, **kwargs: Any
) -> Response
Returns the serialized representation of a single object.
AsyncUpdateModelMixin
Bases: _AsyncCRUDMixinBase
update
async
update(
request: Request, *args: Any, **kwargs: Any
) -> Response
Validates the request body, persists the changes, and returns the
updated representation.
aperform_update(serializer: BaseSerializer[Any]) -> None
Saves the updated instance, awaiting serializer.asave when available.
partial_update
async
partial_update(
request: Request, *args: Any, **kwargs: Any
) -> Response
Runs update() with partial=True so PATCH semantics apply.
AsyncDestroyModelMixin
Bases: _AsyncCRUDMixinBase
destroy
async
destroy(
request: Request, *args: Any, **kwargs: Any
) -> Response
Deletes the resolved instance and returns 204.
aperform_destroy(instance: Any) -> None
Deletes the instance, preferring instance.adelete when available.