django_sorcery.viewsets.mixins module¶
Django REST Framework like viewset mixins for common model sqlalchemy actions.
-
class
django_sorcery.viewsets.mixins.
CreateModelMixin
[source]¶ Bases:
django_sorcery.viewsets.mixins.ModelFormMixin
A mixin for supporting creating objects.
When used with router, it will map the following operations to actions on the viewset
Method Path Action Route Name POST / create <resource name>-list GET /new/ new <resource name>-new
-
class
django_sorcery.viewsets.mixins.
DeleteModelMixin
[source]¶ Bases:
django_sorcery.viewsets.mixins.RetrieveModelMixin
A mixin for supporting deleting objects.
When used with router, it will map the following operations to actions on the viewset
Method Path Action Route Name GET /<pk>/delete/ confirm_destoy <resource name>-delete POST /<pk>/delete/ destroy <resource name>-delete DELETE /<pk>/ destroy <resource name>-detail -
confirm_destroy
(request, *args, **kwargs)[source]¶ Confirm_destory action for displaying deletion confirmation for an object.
-
destroy_success_url
= None¶
-
get_destroy_context_data
(**kwargs)[source]¶ Returns destory context data for rendering deletion confirmation page.
-
-
class
django_sorcery.viewsets.mixins.
ListModelMixin
[source]¶ Bases:
django_sorcery.views.base.BaseMultipleObjectMixin
A mixin for displaying a list of objects.
When used with router, it will map the following operations to actions on the viewset
Method Path Action Route Name GET / list <resource name>-list
-
class
django_sorcery.viewsets.mixins.
ModelFormMixin
[source]¶ Bases:
django.views.generic.edit.FormMixin
,django_sorcery.viewsets.mixins.RetrieveModelMixin
Common mixin for handling sqlalchemy model forms in viewsets.
-
fields
= None¶
-
form_class
= None¶
-
success_url
= None¶
-
-
class
django_sorcery.viewsets.mixins.
RetrieveModelMixin
[source]¶ Bases:
django_sorcery.views.base.BaseSingleObjectMixin
A mixin for displaying a single object.
When used with router, it will map the following operations to actions on the viewset
Method Path Action Route Name GET /<pk>/ retrieve <resource name>-detail
-
class
django_sorcery.viewsets.mixins.
UpdateModelMixin
[source]¶ Bases:
django_sorcery.viewsets.mixins.ModelFormMixin
A mixin for supporting updating objects.
When used with router, it will map the following operations to actions on the viewset
Method Path Action Route Name GET /<pk>/edit/ edit <resource name>-edit POST /<pk>/ update <resource name>-detail PUT /<pk>/ update <resource name>-detail PATCH /<pk>/ update <resource name>-detail