View¶
- class djcrud.view.ViewMixin[source]¶
Bases:
PermissionMixin,Clonable,RouteBase behaviour for every djcrud view: permissions, URLs, Unpoly defaults.
Subclasses and clones inherit
permission_shortcodefrom the class body when set; otherwise it falls back to the viewurlname.Set
unpoly_targetto'body'when the page shell differs from the default layout (for example SPA views using a template named*base_spa.html). Cross-shell navigation uses plain links (FULL_PAGE_LINK_ATTRIBUTES) so scripts such as Svelte components load correctly.- setup(request, *args, **kwargs)[source]¶
Track the active view on the request for cross-shell link wiring.
- property unpoly¶
Unpoly request headers exposed to templates as
view.unpoly.mode, etc.
- property urlpatterns¶
Single Django URL pattern dispatching to this view class.
- property title¶
Human-readable label with the
Viewsuffix removed.
- property color¶
Bulma button/icon color; override on model-backed views.
- property codename¶
URL segment with the
viewsuffix removed from the class name.
- dispatch(request, *args, **kwargs)[source]¶
Redirect anonymous users to login; return 403 when permission denied.
- property permission_shortcode¶
Django permission prefix (
add,change,view, …).
- property permission_codename¶
Permission codename, e.g.
view_document.
- property permission_fullcode¶
Fully qualified permission string, e.g.
myapp.view_document.