On Sunday, 29 January 2012 05:34:50 UTC, Mike wrote:
In a project I'm working on I have a status bar at the top of the webpage that will render data using template tags. The status bar will be displayed on all of my views, so I want to put the html code in my base template. The base template is imported to all of templates using the 'extends' template tag. Now the base template needs a dictionary of data. My question is, how do I pass this data to the base template? I'm passing it in the context data of every view that renders a template, but it seems like there should be a better way - for example the base template calling out to a python function that can add data to the context before its rendered. Is there any other way to pass data to a base template?