viewhelpers.detail — Model object detail views

class DetailView(**kwargs)

Bases: django_cradmin.javascriptregistry.viewmixin.WithinRoleViewMixin, django_cradmin.viewhelpers.mixins.CommonCradminViewMixin, django_cradmin.viewhelpers.mixins.QuerysetForRoleMixin, django.views.generic.detail.DetailView

Base detail view for Django cradmin views.

Note

You should import this class with from django_cradmin import viewhelpers, and refer to it using viewhelpers.detail.DetailView.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

get_context_data(**kwargs)

Insert the single object into the context dict.

class DetailRoleView(**kwargs)

Bases: django_cradmin.viewhelpers.detail.DetailView

Extends DetailView to streamline creating a detail view for the current role object.

Just like DetailView, but with the get_object and get_queryset_for_role methods implemented to edit the current role object.

Note

You should import this class with from django_cradmin import viewhelpers, and refer to it using viewhelpers.detail.DetailRoleView.

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

get_object(queryset=None)

Returns the object the view is displaying.

By default this requires self.queryset and a pk or slug argument in the URLconf, but subclasses can override this to return any object.

get_queryset_for_role()

Get a queryset with all objects of self.model that the current role can access.