django_sorcery.viewsets package¶
-
class
django_sorcery.viewsets.
GenericViewSet
(**kwargs)[source]¶ Bases:
django.views.generic.base.TemplateResponseMixin
,django.views.generic.base.View
Base class for all sqlalchemy model generic viewsets.
-
classmethod
as_view
(actions=None, **initkwargs)[source]¶ Main entry point for a request-response process.
-
classmethod
-
class
django_sorcery.viewsets.
ModelViewSet
(**kwargs)[source]¶ Bases:
django_sorcery.viewsets.mixins.CreateModelMixin
,django_sorcery.viewsets.mixins.UpdateModelMixin
,django_sorcery.viewsets.mixins.DeleteModelMixin
,django_sorcery.viewsets.base.ReadOnlyModelViewSet
A viewset that provides default new(), create(), retrieve(), edit(), update()`, confirm_destroy()), destroy() and list() actions.
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 POST / create <resource name>-list GET /new/ new <resource name>-new GET /<pk>/ retrieve <resource name>-detail POST /<pk>/ update <resource name>-detail PUT /<pk>/ update <resource name>-detail PATCH /<pk>/ update <resource name>-detail DELETE /<pk>/ destroy <resource name>-detail GET /<pk>/edit/ edit <resource name>-edit GET /<pk>/delete/ confirm_destoy <resource name>-delete POST /<pk>/delete/ destroy <resource name>-delete
-
class
django_sorcery.viewsets.
ReadOnlyModelViewSet
(**kwargs)[source]¶ Bases:
django_sorcery.viewsets.mixins.ListModelMixin
,django_sorcery.viewsets.mixins.RetrieveModelMixin
,django_sorcery.viewsets.base.GenericViewSet
A viewset that provides default list() and retrieve() actions.
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 GET /<pk>/ retrieve <resource name>-detail
-
class
django_sorcery.viewsets.
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.
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.
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.
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.
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.
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