Hello, I am having some trouble using Queryset's extra method. I can't find a way to OR together multiple such clauses. Here's my case:
I am using Django 1.4 on PostgreSQL 9.2 and I need to perform accent insensitive queries on some models. In Postgres, this is handled by the unaccent function. The best way I've found to perform this query through Django's ORM is by using the extra method, like so: queryset.extra( where=['unaccent("table_name"."column_name"::text) LIKE unaccent(%s)'], params=['%%%s%%' % value] ) Since I need to perform similar queries all over my codebase, I've written some wrappers around Django's lookups, so the above can be substituted by: queryset = contains_ai(queryset, attribute_name, value) The problem I'm having is that depending on the request I need to compose multiple such queries, sometimes with OR statements. As far as I know the only way to OR together multiple filters is by using Q objects, but there is no way to use extra (or even raw sql) with them. I could write both OR clauses on the where clause, but then I will no longer be able to conditionaly compose multiple such statements together. Is there a way to OR together results form the extra method? Thanks for your help! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.