Skip to content

Instantly share code, notes, and snippets.

@synotna
Created February 27, 2015 14:31
Show Gist options
  • Save synotna/174fa662f0d171baa8ba to your computer and use it in GitHub Desktop.
Save synotna/174fa662f0d171baa8ba to your computer and use it in GitHub Desktop.
Combine Django Q objects
def combine_q_or(q_objects=None):
if q_objects is None:
q_objects = []
if len(q_objects):
return reduce(OR, q_objects)
return Q()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment