Page(id, lft, rght, tree_id, level, active, title, slug, parent_id, in_navigation, override_url, redirect_to, _cached_url)
Returns a queryset describing all active children of the current page. This is different than page.get_descendants (from mptt) as it will additionally select only child pages that are active.
Returns a queryset describing all active children that also have the in_navigation flag set. This might be used eg. in building navigation menues (only show a disclosure indicator if there actually is something to disclose).
Check whether all ancestors of this page are active
Return a string that may be used as cache key for the current page. The cache_key is unique for each content type and content instance.
Generate an etag for this page. An etag should be unique and unchanging for as long as the page content does not change. Since we have no means to determine whether rendering the page now (as opposed to a minute ago) will actually give the same result, this default implementation returns None, which means “No etag please, thanks for asking”.
Response processor to set an etag header on outgoing responses. The Page.etag() method must return something valid as etag content whenever you want an etag header generated.
After rendering a page to a response, the registered response processors are called to modify the response, eg. for setting cache or expiration headers, keeping statistics, etc.
Return the absolute URL of this page.
Return either redirect_to if it is set, or the URL of this page.
This might be overriden/extended by extension modules.
As the name says.
Check whether this page and all its ancestors are active
Generate a last modified date for this page. Since a standard page has no way of knowing this, we always return “no date” – this is overridden by the changedate extension.
Registers the passed callable as request processor. A request processor always receives two arguments, the current page object and the request.
Registers all passed callables as request processors. A request processor always receives two arguments, the current page object and the request.
Registers the passed callable as response processor. A response processor always receives three arguments, the current page object, the request and the response.
Registers all passed callables as response processors. A response processor always receives three arguments, the current page object, the request and the response.
Checks whether any ancestors are actually inaccessible (ie. not inactive or expired) and raise a 404 if so.
Overridden save method which updates the _cached_url attribute of this page and all subpages. Quite expensive when called with a page high up in the tree.
Before rendering a page, run all registered request processors. A request processor may peruse and modify the page or the request. It can also return a HttpResponse for shortcutting the page rendering and returning that response immediately to the client.
setup_request stores responses returned by request processors and returns those on every subsequent call to setup_request. This means that setup_request can be called repeatedly during the same request-response cycle without harm - request processors are executed exactly once.
Title shortened for display.
The page manager. Only adds new methods, does not modify standard Django manager behavior in any way.
Return the best match for a path. If the path as given is unavailable, continues to search by chopping path components off the end.
Tries hard to avoid unnecessary database lookups by generating all possible matching URL prefixes and choosing the longest match.
Page.best_match_for_path(‘/photos/album/2008/09’) might return the page with url ‘/photos/album/’.
Return a page for the request
Does not hit the database more than once for the same request.
Examples:
Page.objects.for_request(request, raise404=True, best_match=False)
Defaults to raising a DoesNotExist exception if no exact match could be determined.
Returns active pages which have the in_navigation flag set.
Return a page for a path. Optionally raises a 404 error if requested.
Example:
Page.objects.page_for_path(request.path)
Returns top-level navigation entries.
The PageSitemap can be used to automatically generate sitemap.xml files for submission to index engines. See http://www.sitemaps.org/ for details.
Consider all pages that are active and that are not a redirect
The priority is staggered according to the depth of the page in the site. Top level get highest priority, then each level is decreased by per_level.
Add an excerpt field to the page.
This introduces a new page type, which has no content of its own but inherits all content from the linked page.
Sometimes, a single title is not enough, you’d like subtitles, and maybe differing titles in the navigation and in the <title>-tag. This extension lets you do that.
Track the modification date for objects.
Intercept attempts to save and insert the current date and time into creation and modification date fields.
Track the content types for pages. Instead of gathering the content types present in each page at run time, save the current state at saving time, thus saving at least one DB query on page delivery.
Clobber the _ct_inventory attribute of this object
Clobber the _ct_inventory attribute of this object and all sub-objects on save.
Add a “featured” field to objects so admins can better direct top content.
Add a keyword and a description field which are helpful for SEO optimization.