无法连接'str'和'WSGIRequest'对象

时间:2011-12-06 21:04:54

标签: django django-templates django-views

我在尝试加载模板时遇到此错误:

TypeError: cannot concatenate 'str' and 'WSGIRequest' objects

以下是粘贴的链接:https://gist.github.com/3b7039baf13d91a67de2

你会注意到traceback中的一行指向我的views.py和下面方法中的最后一行。最后一行可能是问题,如果是这样,我该如何解决它。提前致谢

def all(request):
    """This returns all the photos in the database
    """
    return render_to_response(request, 'photos/all.html', {'photos':
        Photo.objects.all().order_by('-date_added')})

1 个答案:

答案 0 :(得分:2)

render_to_response不接受请求作为其第一个参数。

然而,从Django 1.3开始,

渲染。也许你想要使用的方法?

相关问题