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.
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.
Returns top-level navigation entries.
Page(id, lft, rght, tree_id, level, active, title, slug, parent_id, in_navigation, override_url, redirect_to, _cached_url)
Return the absolute URL of this page.
Attaches a handler which prints the query count (and optionally all individual queries which have been executed) on the console. Does nothing if DEBUG = False.
from feincms.module.page import models, processors models.Page.register_response_processor( processors.debug_sql_queries_response_processor(verbose=True), )
Short-circuits the request-response cycle if the ETag matches.
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.
Fills request._feincms_extra_context with a few useful variables.
Sets the frontend editing state in the cookie depending on the frontend_editing GET parameter and the user’s permissions.
Returns a HttpResponseRedirect instance if the current page says a redirect should happen.
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.
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.
Allows setting a date range for when the page is active. Modifies the active() manager method so that only pages inside the given range are used in the default views and the template tags.
Depends on the page class having a “active_filters” list that will be used by the page’s manager to determine which entries are to be considered active.
This response processor is automatically added when the datepublisher extension is registered. It sets the response headers to match with the publication end date of the page so that upstream caches and the django caching middleware know when to expunge the copy.
Format a date in a nice human readable way: Omit the year if it’s the current year. Also return a default value if no date is passed in.
A datetime.now look-alike that returns times rounded to a five minute boundary. This helps the backend database to optimize/reuse/cache its queries by not creating a brand new query each time.
Also useful if you are using johnny-cache or a similar queryset cache.
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.
This extension adds a language field to every page. When calling the request processors the page’s language is activated. Pages in secondary languages can be said to be a translation of a page in the primary language (the first language in settings.LANGUAGES), thereby enabling deeplinks between translated pages.
It is recommended to activate django.middleware.locale.LocaleMiddleware so that the correct language will be activated per user or session even for non-FeinCMS managed views such as Django’s administration tool.
Set and activate a language, if that language is available.
Determine whether the user has explicitely set a language earlier on. This is taken later on as an indication that we should not mess with the site’s language settings, after all, the user’s decision is what counts.