我想在整个网站的页脚中有一个包含最新帖子的部分。我的页脚位于 base.html 中。
我怎么能有这个:
def footer(request):
return render_to_response('base.html', {'posts_latest':Post.objects.order_by('-published'),},)
在每一页上?要显示它,我必须将函数与 url 连接起来,但我不能对所有这些函数都这样做。
我试过这个上下文处理器教程,但我一直收到错误:
Error importing request processor module myapp.app.context_processors: "No module named context_processors"
所以我放弃了这个想法。
你有什么建议?
提前致谢。