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:04] eide |
devel:blueprints:django_template [2010/01/13 10:46] eide django template blocks |
||
---|---|---|---|
Line 2: | Line 2: | ||
In the future NAV should mainly use Django templates, falling back to cheetah on old subsystems. | In the future NAV should mainly use Django templates, falling back to cheetah on old subsystems. | ||
+ | |||
+ | ===== Django systems ===== | ||
+ | |||
+ | Something smart here | ||
+ | |||
+ | ==== 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. | ||
+ | |||
+ | === Debug === | ||
+ | |||
+ | Provides a SQL debug table at the bottom of every Django page if the DEBUG setting is set to true. | ||
+ | |||
+ | === Account_processor === | ||
+ | |||
+ | 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). | ||
+ | |||
+ | === nav_version === | ||
+ | |||
+ | 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. | ||
+ | |||
+ | | base_header | The header. Doctype, HTML head section and the header parts of the html. | | ||
+ | | base_header_head | The head block. | | ||
+ | | base_header_title | The title of the page. | | ||
+ | | base_header_additional_head | Any additional content that should go inside the head tag. Ie. extra CSS or JavaScript | | ||
+ | | base_body_start | The opening body tag. | | ||
+ | | base_header_logo | The NAV logo. | | ||
+ | | base_header_navbar | The navigation bar with breadcrumbs, customizable navbar and quick-links. | | ||
+ | | base_header_navpath | Breadcrumb path. | | ||
+ | | base_content | The content of the page. This one should be overwritten by subsystems to display the content. | | ||
+ | | base_debug | Output from the debug preprocessor. | | ||
+ | | base_footer | The footer | | ||
===== Backwards compability ===== | ===== Backwards compability ===== | ||
Line 17: | Line 55: | ||
Ie. if a subsystem wants to use foobar.css, it must appear in additionalCSS as such: | Ie. if a subsystem wants to use foobar.css, it must appear in additionalCSS as such: | ||
- | '' | + | <code> |
#def additionalCSS | #def additionalCSS | ||
<link rel="stylesheet" type="text/css" href="foobar.css" /> | <link rel="stylesheet" type="text/css" href="foobar.css" /> | ||
#end def additionalCSS | #end def additionalCSS | ||
- | '' | + | </code> |