lambdamusic
2/7/2013 - 9:25 PM

Django: Django Q objects

Django: Django Q objects

from django.db.models import Q

Publisher.objects.filter(Q(state_province="CA") | Q(state_province="AZ"))

#or also more programmatically:

args = ( Q( title__icontains = 'Foo' ) | Q( title__icontains = 'Bar' ) )
entries = Entry.objects.filter( *args)