I have this in my views.py:
def announcements(request):
return render_to_response('events.html', {
'posts1': Blog.objects.filter(category__title="Announcements")
}, context_instance=RequestContext(request)
)
And this in my base.html:
{{ posts1 }}
But nothing from the above request context gets rendered when I load the home page.
Edit 1:
It looks like I am on a wrong path here. My aim is to display the posts under "announcement" category throughout my开发者_运维百科 website in a fixed sidebar. Whichever page is opened the sidebar in that page should contain only posts from "announcement" category. Any suggestion for how to achieve it?
Create an inclusion template tag and use it in templates where you want to display that sidebar.
精彩评论