Sorry, I have no idea how to make Django execute: from django.db.models import Q from django.shortcuts import render_to_response from btaylor_design_v2.portfolio.models import WorkSample
qset = ( Q(title__icontains='whatever') | Q(client__name__icontains='whatever') ) results = WorkSample.objects.select_related().filter(qset).distinct() from the shell On Apr 9, 11:17 am, Rajesh Dhawan <[EMAIL PROTECTED]> wrote: > On Apr 9, 11:55 am, Brandon Taylor <[EMAIL PROTECTED]> wrote: > > > Hi Rajesh, > > > Thanks for the reply. Using select_related() isn't working either. I > > tried that earlier :) I'm not as familiar with running Django form the > > command line as I am with Rails - I'm not quite sure how to tell > > Python which settings module to use. Can you please help me out? > > Drop into a shell/command prompt to your Django project directory (the > dir that contains your settings.py). Then do this: > > python manage.py shell > > This gives you a shell from which you can try out your query. It > assumes you have python in your PATH. Make sure DEBUG=True in your > settings before you drop into this shell. That way, you will be able > to run your search query manually and then check out the SQL that > Django executed. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---