views

class ella.core.views.ListContentType

List objects’ listings according to the parameters. If no filtering is applied (including pagination), the category’s title page is rendered:

  • page/category/<tree_path>/category.html
  • page/category.html

Otherwise an archive template gets rendered:

  • page/category/<tree_path>/content_type/<app>.<model>/listing.html
  • page/category/<tree_path>/listing.html
  • page/content_type/<app>.<model>/listing.html
  • page/listing.html

The context contains:

  • category
  • listings: list of Listing objects ordered by date and priority
  • page: django.core.paginator.Page instance
  • is_paginated: True if there are more pages
  • results_per_page: number of objects on one page
  • content_type: ContentType of the objects, if filtered on content type
  • content_type_name: name of the objects’ type, if filtered on content type
Parameters:
  • categorytree_path of the Category, root category is used if empty
  • year, month, day – date matching the publish_from field of the Listing object.
  • content_type – slugified verbose_name_plural of the target model, if omitted all content_types are listed
  • page_no – which page to display
  • paginate_by – number of records in one page

All parameters are optional, filtering is done on those supplied

Raises Http404:if the specified category or content_type does not exist or if the given date is malformed.
class ella.core.views.ObjectDetail

Renders a page for placement. If url_remainder is specified, tries to locate custom view via DetailDispatcher.call_view(). If DetailDispatcher.has_custom_detail() returns True, calls DetailDispatcher.call_custom_detail(). Otherwise renders a template with context containing:

  • placement: Placement instance representing the URL accessed
  • object: Publishable instance bound to the placement
  • category: Category of the placement
  • content_type_name: slugified plural verbose name of the publishable’s content type
  • content_type: ContentType of the publishable

The template is chosen based on the object in question (the first one that matches is used):

  • page/category/<tree_path>/content_type/<app>.<model>/<slug>/object.html
  • page/category/<tree_path>/content_type/<app>.<model>/object.html
  • page/category/<tree_path>/object.html
  • page/content_type/<app>.<model>/object.html
  • page/object.html
Parameters:
  • requestHttpRequest from Django
  • categoryCategory.tree_path (empty if home category)
  • content_type – slugified verbose_name_plural of the target model
  • year month day – date matching the publish_from field of the Placement object
  • slug – slug of the Placement
  • url_remainder – url after the object’s url, used to locate custom views in custom_urls.dispatcher
Raises Http404:

if the URL is not valid and/or doesn’t correspond to any valid Placement

Previous topic

templatetags

Next topic

Positions

This Page