List View — Pyramid Class-Based Views 1.0 documentation

# List View

class `pyramid_views.views.list.` `ListView`(**kwargs)

  Render some list of objects, set by `self.model` or `self.query`. `self.query` can actually be any iterable of items, not just a query.

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

    Return the list of items for this view.

    The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

  `template_name` = None
  `template_extension` = '.pt'
  `content_type` = None
  `template_name_suffix` = '_list'
  `get_context_data`(**kwargs)

    Get the context for this view.

  `get_context_object_name`(object_list)

    Get the name of the item to be used in the context.

  `allow_empty` = True
  `get_allow_empty`()

    Returns `True` if the view should display empty lists, and `False` if a 404 should be raised instead.

  `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>`.

  `paginate_by` = None
  `get_paginate_by`(query)

    Get the number of items to paginate by, or `None` for no pagination.

  `paginate_orphans` = 0
  `get_paginate_orphans`()

    Returns the maximum number of orphans extend the last page by when paginating.

  `page_kwarg` = 'page'
  `get`(request, *args, **kwargs)