开发者

Django query order depending on starts_with and contains

I try to make a special contains filter in django such that,

the list should be ordered as abc,bca because abc starts with ab even though they both contains ab.

How can I make such query in django effectively ?

My query is at below

EmployerIndexed.objects.filter(name__icontains=empkw)


If I understand what you're asking, you want an alphabetical sort?

EmployerIndexed.objects.filter(name__icontains=empkw).order_by('name')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜