Skip to content

Instantly share code, notes, and snippets.

@jtiai
Created March 26, 2013 11:40
Show Gist options
  • Save jtiai/5244777 to your computer and use it in GitHub Desktop.
Save jtiai/5244777 to your computer and use it in GitHub Desktop.
# Power of Q objects
from django.db.models import Q
q = Q()
for v in vals:
q |= Q(myfield__iexact=v)
MyModel.objects.filter(q)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment