Skip to content

Instantly share code, notes, and snippets.

@proger
Created December 8, 2010 13:15
Show Gist options
  • Select an option

  • Save proger/733270 to your computer and use it in GitHub Desktop.

Select an option

Save proger/733270 to your computer and use it in GitHub Desktop.
In [32]: k = [Q(**{'%s__icontains' % f: ' '}) for f in [f.name for f in MyModel._meta.fields if f.__class__ is db.models.TextField]]
In [33]: reduce(lambda all, q: all|q, k, Q())
Out[33]: <db.models.query_utils.Q object at 0x162fe0630>
In [34]: MyModel.objects.filter(_)
[.....]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment