Re: Can't perform Querying using Q objects

2015-03-12 Thread Vijay Khemlani
At least when using Postgres that query makes a LEFT OUTER JOIN so it shouldn't discard Shops just because they don't have a state or city. So your query seems to be OK are you sure your search text is fine? the orm will not automatically strip the search_text into a list of keywords or things li

Re: Can't perform Querying using Q objects

2015-03-11 Thread Vijay Khemlani
At least when I tested a similar query it makes an OUTER JOIN, not an INNER JOIN What's the actual SQL command being executed? print Shops.objects.filter(...).query On Wed, Mar 11, 2015 at 1:19 PM, Ajay M wrote: > Hi Vijay, > The search text is okay.. I think when using the state__state_nam

Re: Can't perform Querying using Q objects

2015-03-11 Thread Ajay M
Hi Vijay, The search text is okay.. I think when using the state__state_name and city__city_name relations Django INNER JOIN removes the shop without existing relation from the result. On Wednesday, March 11, 2015 at 8:22:55 PM UTC+5:30, Vijay Khemlani wrote: > > At least when using Post

Can't perform Querying using Q objects

2015-03-11 Thread Ajay M
Hi I'm a newbie to Django. I'm trying to implement a search feature like this. query_results = Shops.objects.filter\ (Q(shop_name__icontains=search_text)\ |Q(state__state_name__icontains=search_text)\ |Q(city_