cms.core.template package¶
Subpackages¶
Submodules¶
cms.core.template.cms_plugin module¶
cms.core.template.loader_tags module¶
Bases:
django.template.loader_tags.ExtendsNodeAllows the template
foo/bar.htmlto extendfoo/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_directoriesandfilesystem) 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, andcachedloaders are supported. Theeggsloader, and any loader that implementsload_template_sourcewith a source string returned, should also theoretically work.Replacement for Django’s
find_templatethat 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.
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.
Extended version of Django’s
extendstag that allows circular inheritance to occur, eg a template can both be overridden and extended at once.
cms.core.template.middleware module¶
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'¶
-
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.LibraryExtends
django.template.Libraryproviding 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)¶
-