【发布时间】:2010-08-20 09:55:12
【问题描述】:
在我的模型上我有
class Meta:
ordering = ['title']
有没有办法我可以将它留在模型定义中,因为它在其他地方有用,但在查询中告诉它忽略它而不需要排序?
【问题讨论】:
标签: django
在我的模型上我有
class Meta:
ordering = ['title']
有没有办法我可以将它留在模型定义中,因为它在其他地方有用,但在查询中告诉它忽略它而不需要排序?
【问题讨论】:
标签: django
文档是你的朋友: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.
【讨论】: