This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
devel:blueprints:django_template [2010/01/13 10:50] eide template variables |
devel:blueprints:django_template [2010/01/13 12:07] eide context processors as a table |
||
---|---|---|---|
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: debug, account 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. | | |
- | 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). | + | | 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 | | |
- | === nav_version === | + | | toolbar | All available tools from the toolbox (not enabled by default) | |
- | + | ||
- | Returns the version number from nav.web.buildconf | + | |
==== Template blocks and variables ==== | ==== Template blocks and variables ==== |