Skip to content

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

create async

create(request, *args, **kwargs)

Validates the request body, persists the instance, and returns 201.

aperform_create async

aperform_create(serializer)

Saves the new instance, awaiting serializer.asave when available.

get_success_headers

get_success_headers(data)

Returns the headers that should be set on the 201 response.

AsyncListModelMixin

list async

list(request, *args, **kwargs)

Returns a serialized, optionally paginated list of objects.

AsyncRetrieveModelMixin

retrieve async

retrieve(request, *args, **kwargs)

Returns the serialized representation of a single object.

AsyncUpdateModelMixin

update async

update(request, *args, **kwargs)

Validates the request body, persists the changes, and returns the updated representation.

aperform_update async

aperform_update(serializer)

Saves the updated instance, awaiting serializer.asave when available.

partial_update async

partial_update(request, *args, **kwargs)

Runs update() with partial=True so PATCH semantics apply.

AsyncDestroyModelMixin

destroy async

destroy(request, *args, **kwargs)

Deletes the resolved instance and returns 204.

aperform_destroy async

aperform_destroy(instance)

Deletes the instance, preferring instance.adelete when available.