View

class djmvc.view.ViewMixin[source]

Bases: Clonable, Route

Base behaviour for every djmvc view: permissions, URLs, Unpoly defaults.

Subclasses and clones inherit permission_shortcode from the class body when set; otherwise it falls back to the view urlname.

property urlpatterns

Single Django URL pattern dispatching to this view class.

property title

Human-readable label with the View suffix removed.

property breadcrumb_title

Breadcrumb label; defaults to title.

property codename

URL segment with the view suffix removed from the class name.

dispatch(request, *args, **kwargs)[source]

Redirect anonymous users to login; return 403 when permission denied.

get_json_method_names()[source]

Return HTTP verbs supported by json_* handlers on this view.

get_swagger_path_definition()[source]

Collect per-method Swagger path definitions.

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.

has_permission()[source]

Return whether the current user may access this view.

has_permission_backend()[source]

Check Django permissions, then view-aware custom backends.

breadcrumbs(with_self=True)[source]

Return breadcrumb trail; override in object views.

unpoly_attributes(context=None)[source]

HTML attributes for Unpoly navigation on this view.

querystring(**params)[source]

Current GET query string with params merged in.

class djmvc.view.View(**kwargs)[source]

Bases: ViewMixin, View

Minimal djmvc view for custom non-generic handlers.

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