阅读背景:

Django:通过多对多字段订购模型

来源:互联网 

I am writing a Django application that has a model for People, and I have hit a snag. I am assigning Role objects to people using a Many-To-Many relationship - where Roles have a name and a weight. I wish to order my list of people by their heaviest role's weight. If I do People.objects.order_by('-roles__weight'), then I get duplicates when people have multiple roles assigned to them.I am writing a Django application that has a mo




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: