I'm not sure this is the right way, but you could drop the Q objects, use
only icontains and sort by the length of 'name'
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an
On Wed, Mar 6, 2013 at 11:58 AM, Alexander Todorov
wrote:
> Hi guys,
> I have this type of query:
>
> .filter(name__icontains='celery')
>
> and will possibly replace it with
>
> .filter(Q(name='celery') | Q(name__icontains='celery'))
>
>
> I want to get the results
Hi guys,
I have this type of query:
.filter(name__icontains='celery')
and will possibly replace it with
.filter(Q(name='celery') | Q(name__icontains='celery'))
I want to get the results ordered by exact match first. Is this possible or
I need to sort the results in my code?
Regards,
Alex
3 matches
Mail list logo