User Tools

Site Tools


devel:blueprints:django_template

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
devel:blueprints:django_template [2010/01/13 10:46]
eide django template blocks
devel:blueprints:django_template [2010/01/13 12:09]
eide
Line 11: Line 11:
 Some features of the templates, such as debug, version number and account/​user info and preferences requires context processors. Some features of the templates, such as debug, version number and account/​user info and preferences requires context processors.
  
-Currently these context ​processors are: debugaccount and nav_version.+Context ​processors are not passed to templates by default with render_to_response()a RequestContext object must be passed to render_to_response to get them.
  
-=== Debug ===+Without the account_processor all user specific content in templates will not work.
  
-Provides a SQL debug table at the bottom of every Django page if the DEBUG setting is set to true.+<​code>​ 
 +render_to_response( 
 +    'path/to/​template',​ 
 +     ​{'​some_context':​ var}, 
 +     ​RequestContext(request) 
 +
 +</​code>​
  
-=== Account_processor ===+^   NAV context processors ​  ^^ 
 +| debug | Provides a SQL debug table at the bottom of every Django page if the DEBUG setting is set to true. | 
 +| account_processor | Provides account object for current user, a flag telling if he/she is and admin, messages for the user and custom navigation bar. | 
 +| nav_version | The version number from nav.web.buildconf | 
 +| toolbar | All available tools from the toolbox (not enabled by default) |
  
-Provides the account object for the current user, a flag telling if he/she is an admin, messages for the user and the custom links found in the navbar (includes quick links).+==== Template blocks ​and variables ====
  
-=== nav_version === +The base templates contains a number of template blocks and variables ​that both can be overwritten by subsystems.
- +
-Returns the version number from nav.web.buildconf +
- +
-==== Template blocks and filters ==== +
- +
-The base templates contains a number of template blocks and tags that both can be overwritten by subsystems.+
  
 +^   ​Blocks ​  ^^
 | base_header | The header. Doctype, HTML head section and the header parts of the html. | | base_header | The header. Doctype, HTML head section and the header parts of the html. |
 | base_header_head | The head block. | | base_header_head | The head block. |
Line 40: Line 45:
 | base_debug | Output from the debug preprocessor. | | base_debug | Output from the debug preprocessor. |
 | base_footer | The footer | | base_footer | The footer |
 +
 +^   ​Variables ​  ^^
 +| title | Title of the page. Appears inside base_header_title so subsystems can use either one of them. |
 +| navpath | Breadcrumb path. Contains a list of tuples on the form (url, title). If url is None regular text is displayed, else you get an anchor. |
 +| navbar | Users navigation bar. Supplied from account_processor. |
 +| qlink1 and qlink2 | Quick link drop-downs. Supplied from account_processor. |
 +| nav_version | NAV Version, supplied from nav_version context preprocessor. |
  
 ===== Backwards compability ===== ===== Backwards compability =====
Line 46: Line 58:
  
 Compability with Django templates are done seamless. The MainTemplate includes nav.webfront.compability.Cheetah which provides two methods called footer and header. These two methods are simply printed, and thus the header and footer appears. Compability with Django templates are done seamless. The MainTemplate includes nav.webfront.compability.Cheetah which provides two methods called footer and header. These two methods are simply printed, and thus the header and footer appears.
 +
 +MainTemplate will automatically populate the needed instance variables for the Cheetah compability class.
  
 ==== Additional <​head>​ content ==== ==== Additional <​head>​ content ====
devel/blueprints/django_template.txt · Last modified: 2010/01/13 12:16 by eide