一个测试文章
用 WIndows Live Writer 编写的。
def blogs(request, username=None, template_name="blog/blogs.html"): blogs = Post.objects.filter(status=2).select_related(depth=1).order_by("-publish") if username is not None: user = get_object_or_404(User, username=username.lower()) blogs = blogs.filter(author=user) return render_to_response(template_name, { "blogs": blogs, }, context_instance=RequestContext(request))