-
Book Overview & Buying
-
Table Of Contents
Django 1.0 Template Development
In the course of your Django development you may have data that you want to make available to your Context without having to specify it in every view. This could be things such as information about the current authenticated user, media settings, or a custom piece of data that you need in all of your templates. If you find yourself adding the same items to your Context in many views, it's a good candidate for a context processor.
Django provides us a set of libraries for commonly used context processors. These include auth, debug, i18n, and media. Each of these libraries adds extra variables to our context that we can use from within our templates.
Auth adds the variables user, messages, and perms to the context. user is the currently logged in user, messages is a list of messages for that user (you see this a lot in the admin app when you change something—it's the message at the top of the screen after you add/save/delete)...
Change the font size
Change margin width
Change background colour