Home > Q&A > body text
正常排序如: res = queryset.all().order_by('-publish_time')那假设想在title的字段里有abc的排在前面,那应该怎么写呢?谢谢了
res = queryset.all().order_by('-publish_time')
PHP中文网2017-04-18 10:30:02
res = queryset.extra(select = { '_has' : 'instr(title, "abc")'}).order _by('-_has')