1
如何使用django的generic class DetailView
获取当前用户相关对象?使用基于函数的观点,我能得到这样的对象:如何使用django泛型类detailview获取用户特定的对象?
def foo(request):
friendProfile = get_object_or_404(request.user.profile.friends,username="admin")
什么是相当于使用详细信息视图?我猜这是与get_object
或get_context_data
有关,但我不能完全理解这些文件。
谢谢。
您能为我提供一个例子吗? – meowmeow
用示例编辑的响应。 –
优秀!谢谢。 – meowmeow