深度阅读

django listview 排序字段 order by listview django

作者
作者
2023年08月22日
更新时间
3.49 分钟
阅读时间
0
阅读量

列表中设置排序字段

class Reviews(ListView):
    model = ProductReview
    paginate_by = 50
    template_name = 'review_system/reviews.html'
    #add ordering: the least before the attribute means decreasing order
    ordering = ['-date_created']

相关链接
https://www.codegrepper.com/code-examples/python/frameworks/django/order+by+listview+django

相关标签

博客作者

热爱技术,乐于分享,持续学习。专注于Web开发、系统架构设计和人工智能领域。