Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

68 lines (49 sloc) 2.487 kb

Management Views

A :term:`management view` is a :term:`view configuration` that applies only when the URL is prepended with the :term:`manage prefix`. The manage prefix is usually /manage, unless you've changed it from its default by setting a custom substanced.manage_prefix in your application's .ini file.

This means that views declared as management views will never show up in your application's "retail" interface (the interface that "normal" unprivileged users see). They'll only show up when a user is using the :term:`SDI` to manage content.

There are two ways to define management views:

The former is most convenient, but they are functionally equivalent. mgmt_view just calls into add_mgmt_view when found via a :term:`scan`.

Declaring a management view is much the same as declaring a "normal" Pyramid view using :class:`pyramid.view.view_config` with a route_name of substanced_manage. For example, each of the following view declarations will register a view that will show up when the /manage/foobar URL is visited:

The above is largely functionally the same as this:

Management views, in other words, are really just plain-old Pyramid views with a slightly shorter syntax for definition. Declaring a view a management view, however, does do some extra things that make it advisable to use rather than a plain Pyramid view registration:

  • It registers introspectable objects that the SDI interface uses to try to find management interface tabs (the row of actions at the top of every management view rendering).
  • It allows you to associate a tab title, a tab condition, and cross-site request forgery attributes with the view.

So if you want things to work right when developing management views, you'll prefer @mgmt_view over @view_config, and config.add_mgmt_view over config.add_view.

Jump to Line
Something went wrong with that request. Please try again.