cms.core.template package

Submodules

cms.core.template.cms_plugin module

class cms.core.template.cms_plugin.CMSPlugin

Bases: cms.core.plugins.CMSPluginBase

description = <django.utils.functional.__proxy__ object at 0x24741d0>
status = 'testing'
verbose_name = <django.utils.functional.__proxy__ object at 0x2474250>
version = '0.2'

cms.core.template.loader_tags module

class cms.core.template.loader_tags.OverExtendsNode(nodelist, parent_name, template_dirs=None)

Bases: django.template.loader_tags.ExtendsNode

Allows the template foo/bar.html to extend foo/bar.html, given that there is another version of it that can be loaded. This allows templates to be created in a project that extend their app template counterparts, or even app templates that extend other app templates with the same relative name/path.

We use our own version of find_template, that uses an explict list of template directories to search for the template, based on the directories that the known template loaders (app_directories and filesystem) use. This list gets stored in the template context, and each time a template is found, its absolute path gets removed from the list, so that subsequent searches for the same relative name/path can find parent templates in other directories, which allows circular inheritance to occur.

Django’s app_directories, filesystem, and cached loaders are supported. The eggs loader, and any loader that implements load_template_source with a source string returned, should also theoretically work.

find_template(name, context, peeking=False)

Replacement for Django’s find_template that uses the current template context to keep track of which template directories it has used when finding a template. This allows multiple templates with the same relative name/path to be discovered, so that circular template inheritance can occur.

get_parent(context)

Load the parent template using our own find_template, which will cause its absolute path to not be used again. Then peek at the first node, and if its parent arg is the same as the current parent arg, we know circular inheritance is going to occur, in which case we try and find the template again, with the absolute directory removed from the search list.

cms.core.template.loader_tags.overextends(parser, token)

Extended version of Django’s extends tag that allows circular inheritance to occur, eg a template can both be overridden and extended at once.

cms.core.template.middleware module

class cms.core.template.middleware.TemplateForDeviceMiddleware

Bases: object

Inserts device-specific templates to the template list.

process_request(request)
process_template_response(request, response)

cms.core.template.panels module

class cms.core.template.panels.TemplateTimings(toolbar)

Bases: debug_toolbar.panels.Panel

disable_instrumentation()
enable_instrumentation()
has_content = True
name = 'TemplateTimingPanel'
nav_subtitle
nav_title
process_response(request, response)
template = 'debug_toolbar/template_timings.html'
title = 'Template Timings'
cms.core.template.panels.record(*args, **kwargs)
cms.core.template.panels.record_query(**kwargs)
cms.core.template.panels.replace_method(klass, method_name)
cms.core.template.panels.wrap_generic_node(node, name)

Module contents

class cms.core.template.Library

Bases: django.template.base.Library

Extends django.template.Library providing several shortcuts that attempt to take the leg-work out of creating different types of template tags.

inclusion_tag(file_name, context_class=<class 'django.template.context.Context'>, takes_context=False, name=None)