Detail View — Pyramid Class-Based Views 1.0 documentation

# Detail View

class `pyramid_views.views.detail.` `DetailView`(**kwargs)

  Render a “detail” view of an object.

  By default this is a model instance looked up from `self.query`, but the view will support display of any object by overriding `self.get_object()`.

  `model` = None
  `query` = None
  `get_query`()

    Return the Query that will be used to look up the object.

    Note that this method is called by the default implementation of get_object and may not be called if get_object is overriden.

  `get_object`(query=None)

    Returns the object the view is displaying.

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

  `slug_field` = u'slug'
  `get_slug_field`()

    Get the name of a slug field to be used to look up by slug.

  `slug_url_kwarg` = u'slug'
  `pk_url_kwarg` = u'pk'
  `template_name` = None
  `template_extension` = u'.pt'
  `content_type` = None
  `template_name_suffix` = u'_detail'
  `get_context_data`(**kwargs)

    Insert the single object into the context dict.

  `get_context_object_name`(obj)

    Get the name to use for the object.

  `db_session`
  `macro_names` = None
  `get_macro_names`()

    Return a directory of macro names.

    Values should be template paths, and keys will be used as the lookup key in the template. Eg. `macros.<key>.<macro>`.

  `get`(request, *args, **kwargs)