Page module¶
Models¶
Request and response processors¶
-
feincms.module.page.processors.
debug_sql_queries_response_processor
(verbose=False, file=<open file '<stderr>', mode 'w'>) 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
.Example:
from feincms.module.page import models, processors models.Page.register_response_processor( processors.debug_sql_queries_response_processor(verbose=True), )
-
feincms.module.page.processors.
etag_request_processor
(page, request) Short-circuits the request-response cycle if the ETag matches.
-
feincms.module.page.processors.
etag_response_processor
(page, request, response) 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.
-
feincms.module.page.processors.
extra_context_request_processor
(page, request) Fills
request._feincms_extra_context
with a few useful variables.
-
feincms.module.page.processors.
frontendediting_request_processor
(page, request) Sets the frontend editing state in the cookie depending on the
frontend_editing
GET parameter and the user’s permissions.
-
feincms.module.page.processors.
redirect_request_processor
(page, request) Returns a
HttpResponseRedirect
instance if the current page says a redirect should happen.
Admin classes¶
Sitemap module¶
Extensions¶
Page excerpts¶
Add an excerpt field to the page.
Symlinked page content¶
This introduces a new page type, which has no content of its own but inherits all content from the linked page.
Flexible page titles¶
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.
Extensions not specific to the page module¶
Creation and modification timestamps¶
Track the modification date for objects.
-
feincms.module.extensions.changedate.
pre_save_handler
(sender, instance, **kwargs) Intercept attempts to save and insert the current date and time into creation and modification date fields.
Content type count denormalization¶
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.
-
feincms.module.extensions.ct_tracker.
single_pre_save_handler
(sender, instance, **kwargs) Clobber the _ct_inventory attribute of this object
-
feincms.module.extensions.ct_tracker.
tree_post_save_handler
(sender, instance, **kwargs) Clobber the _ct_inventory attribute of this object and all sub-objects on save.
Date-based publishing¶
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.
-
feincms.module.extensions.datepublisher.
datepublisher_response_processor
(page, request, response) 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.
-
feincms.module.extensions.datepublisher.
format_date
(d, if_none='') 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.
-
feincms.module.extensions.datepublisher.
granular_now
(n=None) 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.
Featured items¶
Add a “featured” field to objects so admins can better direct top content.
Search engine optimization fields¶
Add a keyword and a description field which are helpful for SEO optimization.
Translations¶
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.
-
feincms.module.extensions.translations.
translation_set_language
(request, select_language) Set and activate a language, if that language is available.
-
feincms.module.extensions.translations.
user_has_language_set
(request) 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.