Skip to content

Instantly share code, notes, and snippets.

@gmcquillan
Created January 9, 2014 23:30
Show Gist options
  • Save gmcquillan/8344140 to your computer and use it in GitHub Desktop.
Save gmcquillan/8344140 to your computer and use it in GitHub Desktop.
def build_icontains_filters(model_a, a_attr, model_b_class, b_attr):
"""build filters for model_a in model_b_class amoung `attrs`."""
return {'{0}__icontains'.format(attribute): getattr(model_a, attr)}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment