Posted By

magicrebirth on 12/22/09


Tagged

q queryset


Versions (?)

Django Q objects


 / Published in: Django
 

  1. from django.db.models import Q
  2.  
  3. Publisher.objects.filter(Q(state_province="CA") | Q(state_province="AZ"))
  4.  
  5. #or also more programmatically:
  6.  
  7. args = ( Q( title__icontains = 'Foo' ) | Q( title__icontains = 'Bar' ) )
  8. entries = Entry.objects.filter( *args)

Report this snippet  

You need to login to post a comment.