On 8/16/2010 9:36 PM, Tang Daogang wrote: > Dear all, > > I have developed a CMS, which containing a dynamic menu. Because menu > should be displayed on every page of my site, I need to write the menu > variable into every view function against every page template, this is > very boring... > > So is there some method to implement applying custom variable into > django template automatically? I find some materials, may be > RequestContext can handle it, but I don't know how to insert my custom > variable into it? > > Anyone can help? > > Thank you! > Indeed, James Bennett has already written exactly the blog entry you need. It shows you how to write a context manager, which will allow you to inject common material into the context of every request:
http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/ regards Steve -- DjangoCon US 2010 September 7-9 http://djangocon.us/ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

