【发布时间】:2018-08-29 15:49:51
【问题描述】:
我有这样的看法:
class IndexLatest(ListView):
context_object_name = 'latest'
model = MyModel
template_name = 'my_app/index.html'
def get_queryset(self):
return MyModel.objects.filter(user_id=self.request.user,)
如何将order_by 参数添加到查询集中?该模型有一个日期字段,我尝试在逗号后添加它,但没有成功!
【问题讨论】:
标签: python django django-views django-queryset