我有两个类似的功能,我想知道是否dict
相同add_csrf
?
它们是否都返回与模板中的变量相关的值?
def main(request):
"""Main listing."""
forums = Forum.objects.all()
return render_to_response("forum/list.html", dict(forums=forums, user=request.user))
def forum(request, pk):
"""Listing of threads in a forum."""
threads = Thread.objects.filter(forum=pk).order_by("-created")
threads = mk_paginator(request, threads, 20)
return render_to_response("forum/forum.html", add_csrf(request, threads=threads, pk=pk))