Skip to content
This repository has been archived by the owner on Jun 16, 2018. It is now read-only.

Write fancy filter functions for filter_races to deal with __ filters. #19

Open
schwanksta opened this issue Dec 16, 2011 · 0 comments
Open
Labels

Comments

@schwanksta
Copy link
Contributor

We could update this to split on __ and match that to a different filter function, ala the way Django can filter attribute__icontains.

ex:

filter_functions = {
    None: lambda x: getattr(x, k) == kwargs[k],
    'icontains': lambda x: kwargs[k].lower() in getattr(x, k),
    'contains': lambda x: kwargs[k] in getattr(x, k),
    # ...etc
}

Then you just kwargs[k].split('__') and grab the correct lambda for the filter function.

Probably not THAT useful, but a fun idea.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant