django查询在列表中查看到组类似类别记录
我有我的网站在网站上显示记录这些记录是不同类别的分组记录属于类似类别的类别,并将它们显示在一起
1
列表项目1
列表项目2
列表项目3
类mymixin: def get_queryset(self): 返回record.Objects.all() 类模型: category = model.charfield(max_length = 255,choices = recordScategory.Choices(true,true)
I have my website which displays the records on website these records are of different categories how can group the records belongs to similar category and display them together
category 1
List item 1
List item 2
List item 3
class Mymixin: def get_queryset(self): return Record.objects.all() class Model: category = models.Charfield(max_length=255, choices=RecordsCategory.choices(True, True)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是...按类别订购记录?
关于如何做到这一点:这取决于您没有透露的网站的性质,但最后,它将附加到
任何QuerySet供您提供网站的内容上。并不是说您需要按照以下方式写这篇文章:应该如何编写的内容将大大差异,这取决于您的实际站点技术。
Just... order the records by category?
On how to do that: that depends on the nature of your website, which you didn't disclose, but at the end it will come to appending
to whatever queryset is feeding the website. Not that you need to write this as is: how this should be written will differ greatly depending on your actual site technology.