ignore case order by in Django

179 views
Skip to first unread message

ziggi

unread,
Dec 9, 2011, 12:04:23 AM12/9/11
to Django users
Hi!

I found only way to ordering query results ignorecase by using :
Spam.objects.extra(select={'eggs_upper':'uppper(eggs)',order_by['eggs_upper']})

Maybe has another way to do this?

kenneth gonsalves

unread,
Dec 9, 2011, 7:41:41 AM12/9/11
to django...@googlegroups.com
On Thu, 2011-12-08 at 21:04 -0800, ziggi wrote:
> Maybe has another way to do this?

iequal, icontains ...
--
regards
Kenneth Gonsalves

Tom Evans

unread,
Dec 9, 2011, 7:55:46 AM12/9/11
to django...@googlegroups.com
On Fri, Dec 9, 2011 at 12:41 PM, kenneth gonsalves
<law...@thenilgiris.com> wrote:
> On Thu, 2011-12-08 at 21:04 -0800, ziggi wrote:
>> Maybe has another way to do this?
>
> iequal, icontains ...

OP is talking about case insensitive ordering, not querying (and he
has the simplest way).

Cheers

Tom

Daniel Roseman

unread,
Dec 9, 2011, 8:20:21 AM12/9/11
to django...@googlegroups.com
In MySQL, you can set the collation of your table to be case-insensitive. This affects all queries, though.
--
DR. 

kenneth gonsalves

unread,
Dec 9, 2011, 9:21:36 PM12/9/11
to django...@googlegroups.com

I know, but his query did not use the simplest way.
--
regards
Kenneth Gonsalves

Reply all
Reply to author
Forward
0 new messages