This worked!  Thank you

On Dec 15 2009, 11:27 pm, HARRY POTTRER <cp368...@ohio.edu> wrote:
> you're going to need the Q object, it seems.
>
> from django.db.models import Q
> MyModel.objects.filter(Q(summary__icontains=q) | Q
> (title__icontains=q))
>
> On Dec 15, 10:32 pm, tm <tmugav...@gmail.com> wrote:
>
>
>
> > Hello Django Users,
>
> > I'm trying to use icontains to check 2 fields in the same table for a
> > keyword entered into a search.
>
> > ex I've tried:
>
> > queryset = MyModel.objects.filter(summary__icontains=q).filter
> > (title__icontains=q)
>
> > and
>
> > queryset = MyModel.objects.filter(summary__icontains=q,
> > title__icontains=q)
>
> > Neither work, although judging by the docs the second one shouldn't in
> > this case.  Has anyone successfully searched a MySQL DB using
> > icontains on 2 filelds in the same model?  Any help greatly
> > appreciated :)
>
> > T

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.

Reply via email to