Thanks, Piotr. It was a solution with custom tag but implementation with database requests from template looked not too elegant for me. I'll look into custom context processors.
On Dec 19, 1:25 pm, Piotr Kilczuk <kilc...@gmail.com> wrote: > Hi, > > I have a block, included into several pages (for example, in all > > > sections of my website you can see top rated articles in the right > > column). I can include a template, that prints this list into base > > template and avoid any copy-paste here. > > But I need to provide it with context variable, that contains a list > > of top rated articles, so I need to remember to include > > {'top_articles': top_articles} into all render_to_response calls. > > Is it possible to avoid this duplication somehow? Thanks. > > One of the ways is to use a context processor to pass that variable into > your ctx. > > Another is to code a custom tpl tag. > > I'd choose to write a ctx processor + use some query caching technique. > > Regards, > Piotr -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.