【发布时间】:2013-12-25 04:06:43
【问题描述】:
我真的是 django、python 和 postgres 的新手......我似乎无法找到关于如何 order_by 在使用 Model 作为查询方法时不区分大小写的答案,只有当你使用直接 SQL 查询时。
Model
@classmethod
def get_channel_list(cls, account):
return cls.objects.filter(accountid=account).order_by('-name').values_list('name', 'channelid')
当前排序的数据集和顺序
test
b test
a test channel
a test channel
a test 2
a b test
Test Channel
Test 3
Test 3
Test 2 Channel
任何帮助将不胜感激。
【问题讨论】:
标签: python django python-2.7 django-1.5 postgresql-9.3