Skip to content
This repository was archived by the owner on Jun 16, 2018. It is now read-only.
This repository was 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

@schwanksta

Description

@schwanksta

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions