api.v1.mixins package

Package api.v1.mixins with mixins for the api app.

class api.v1.mixins.ToggleFavoriteMixin[source]

Bases: object

Mixin providing a toggle-favorite action for a viewset.

URL_PATH_TOGGLE_FAVORITE = 'toggle-favorite'
URL_NAME_TOGGLE_FAVORITE = 'toggle-favorite'
toggle_favorite(request, pk=None)[source]

Action method toggling the favorite flag of the object.

Parameters:
  • request (Request) – The request triggering the action.

  • pk (int | None) – The private key of the object to toggle favorite. Defaults to None.

Return type:

Response

Returns:

A response detailing the request status.

Submodules