Thanks for the responses. I ended up going with a template context processor.
On Jun 14, 5:16 pm, Antoni Aloy <antoni.a...@gmail.com> wrote: > 2009/6/14 Alex Gaynor <alex.gay...@gmail.com>: > > > > > > > > > On Sun, Jun 14, 2009 at 3:46 PM, compbry15 <compbr...@gmail.com> wrote: > > >> Hey all, > > >> I am working on a website in which we want the same footer to display > >> on all pages. This normally wouldn't be a problem with django, in > >> fact it would be really easy. The catch here is that we want certain > >> objects to be available on this footer. So no matter what page you > >> were on, if you went down to the footer it would show like the 3 > >> latest blog posts, latest picture, etc etc. > > >> So far I have the footer code in the base.html template, and have > >> abstracted out a helper function that gets all the necessary records > >> and puts them in a dictionary to be passed into a template. The > >> display works fine for pages that I have manually changed the views to > >> call the helper function and pass in the necessary dictionary values, > >> but i'll have to do this for all pages... And that just seems wrong. > > >> I am having trouble finding a proper way to phrase this question for > >> searching the django docs and google, so was wondering if anyone had > >> any ideas for doing this in a DRY sort of fashion. > > >> Thanks! > > > The best way to solve this would either be a template inclusion tag, or a > > template context processor. > > Other way could be to create your own template tag. Write it and use > it in the footer. Remember that is just Python code, so you can use > the Django cache API. Use the template tag in the base.html and > inherit the other templates from base. > > -- > Antoni Aloy López > Blog:http://trespams.com > Site:http://apsl.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---