在我的模特上我有
class Meta:
ordering = ['title']
有没有一种方法可以将其留在模型定义中,因为它在其他地方有用但在查询中告诉它在没有顺序的情况下忽略它?
答案 0 :(得分:3)
文档是您的朋友:http://docs.djangoproject.com/en/dev/ref/models/querysets/#order-by-fields
New in Django 1.0: Please, see the release notes
If you don't want any ordering to be applied to a query,
not even the default ordering, call order_by() with no parameters.